Kodewick
Start learning →
Basic←→0 / 70

Price bands

#055BasicCASE4 min

The shop wants three price bands: 'cheap' when price is under 10, 'normal' from 10 to 19, and 'pricey' for 20 and up. Pick each product's name and its band.

The tables
products
idnamecategorypricestock
1Milk teadrink1230
2Lemon waterdrink850
3Cheesecakecake256
4Cookiesnack580
5Browniecake180
6Iced coffeedrink1520
7Chipssnack740
8Fruit tartcake284
8 rows
query.sql
SELECT name,
  CASE
    -- your code here: two WHENs (price < 10, price < 20) and an ELSE
  END
FROM products;
Ctrl + Enter runs too
Result

Run shows what your query gives. When it looks right, Submit.