Kotomarket: status labels for orders of customers starting with "А"
Kotomarket: status labels for orders of customers starting with "А"
## Module m2 master-check — "Kotomarket"
The orders table holds orders of the Kotomarket pet shop. Build a compact report only for customers whose name starts with the Russian letter "А".
For each such order output four columns:
1. customer — customer name.
2. status — the raw order status.
3. promo — the order's promo code; if it is NULL, substitute the string 'без промокода'.
4. metka — a status label computed by rules (check conditions in this exact order, first match wins):
- if status = 'отменён' → 'отказ';
- else if status = 'доставлен' → 'завершён';
- else if total >= 3000 → 'крупный';
- else → 'в работе'.
Filter: keep only rows where customer starts with А (use LIKE 'А%', the Russian letter).
Sort: by metka ascending (alphabetically), and within the same label by total descending.
### Constraints
Allowed only: SELECT, WHERE, IS NULL/COALESCE, BETWEEN/IN/LIKE, ORDER BY/LIMIT, DISTINCT, CASE. Forbidden: aggregates, GROUP BY, JOIN, subqueries, window functions and date functions.
Expected output sample
This is what a correct answer looks like — its row count is its own, it doesn't have to match the schema tables. Your answer must use the same column names as this sample — alias them with AS if needed.
| customer | status | promo | metka |
|---|---|---|---|
| Анна Котова | оплачен | CAT10 | в работе |
| Аделина Усова | доставлен | без промокода | завершён |
| Аркадий Рыжов | доставлен | WINTER | завершён |
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign in