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.

Exemplo de resposta esperada

É assim que se parece uma resposta correta: ela tem seu próprio número de linhas e não precisa coincidir com as tabelas do esquema. Sua resposta precisa retornar os mesmos nomes de colunas do exemplo: use AS para renomeá-las se for preciso.

customerstatuspromometka
Анна КотоваоплаченCAT10в работе
Аделина Усовадоставленбез промокодазавершён
Аркадий РыжовдоставленWINTERзавершён
PostgreSQLv16
Entre para enviar

O resultado da sua consulta aparecerá aqui

Focus radio
Paused · SomaFM · Fluid