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.
Loading…
Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.
Ask questions, share alternate queries, and explore solutions
Your recent query executions and answer checks
This will insert the verified MySQL solution into your editor so you can study how each clause transforms the table.