按价格把商品分成四档,并按档位顺序输出。
档位 band |
价格区间 |
|---|---|
budget |
0 ≤ price < 50 |
mid |
50 ≤ price < 100 |
premium |
100 ≤ price < 200 |
luxury |
price ≥ 200 |
区间左闭右开:恰好 50 的商品属于 mid,恰好 200 的属于 luxury。price 为 null 的商品 band 为 null。
排序(ordered: true):
- 按档位从低到高:
budget→mid→premium→luxury(注意这不是字母顺序),band为 null 的排在最后; - 同一档位内按
price从高到低; - 再按
product_id从小到大。
输入
products(product_id, name, category, price, cost, launched_on)
输出
列为 product_id, name, price, band,按上面的顺序排列。