Price category without CASE or IF (Yandex Praktikum)
Price category without CASE or IF (Yandex Praktikum)
A Yandex Praktikum trainer module runs a mini-project on a stationery store. Students receive an order catalog and must tell which price tier each item belongs to. The constraint: no CASE, no IF — the category must come from a range JOIN.
Three tables:
- orders(order_id, last_name, product, ordered_at) — ordered_at TIMESTAMPTZ
- prices(product, price) — price NUMERIC(15,2)
- categories(category, price_range) — category VARCHAR(20), price_range NUMRANGE with bounds [limit_1, limit_2)
For each order, pull the item's price and the category whose price_range contains it. Remember: no CASE, no IF — JOIN only.
Expected output sample
| last_name | product | price | category |
|---|---|---|---|
| Ivanova | Notebook | 120.00 | cheap |
| Petrov | Pen | 15.00 | cheap |
| Sokolova | Backpack | 3500.00 | medium |
Yandex Praktikum
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign inFocus radio
Paused · SomaFM · Fluid