SQLQuokka
Start practicing
QuestionsLearnSandboxFeaturesRoadmapFAQ

Median Order Value by Region

Unsolved

Uber Eats analysts prefer medians over averages because a few huge orders skew the mean. Neither MySQL nor Postgres lets you compute a median with a simple aggregate that works in both, so it must be built from window functions. For each region, return `region`, `order_count` (number of orders) and `median_order_value` (rounded to 2 decimals). For an odd number of orders the median is the middle value; for an even number it is the average of the two middle values. Order the results by `region` ascending.

SQL Query Editor (Ctrl+Enter to run)
0 characters · Valid
Canonical Solution Official

Official Solution is Hidden

Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.

Community Q&A & Discussion

Ask questions, share alternate queries, and explore solutions

0 comments
Asked By:
🏢 Uber🏢 Google🏢 Airbnb

Submission History

Your recent query executions and answer checks

Execution Pipeline:
FROM region_orders
Full source dataset
15 rows total
Ready. Type a query to see live execution.
Clause: Auto-Sync · AlaSQL Engine