task03
按照销售单价( sale_price)对练习 6.1 中的 product(商品)表中的商品进行如下分类。
低档商品:销售单价在1000日元以下(T恤衫、办公用品、叉子、擦菜板、 圆珠笔)
中档商品:销售单价在1001日元以上3000日元以下(菜刀)
高档商品:销售单价在3001日元以上(运动T恤、高压锅)
请编写出统计上述商品种类中所包含的商品数量的 SELECT 语句,结果如下所示。
脚本:
select sum(case when sale_price<=1000 then 1 else 0 end) as low_price,
sum(case when sale_price>1000 and sale_price<=3000 then 1 else 0 end) as low_price,
sum(case when sale_price>3000 then 1 else 0 end) as low_price
from product;