Practice · hard · dataset: ecom

Median order value by channel

An operations team wants the typical order size per acquisition channel, and an average would be skewed by a few large baskets. Return the median order value for each channel.

An order’s value is the sum of quantity * unit_price across its line items, over every status.

Return channel and median_order_value, rounded to two decimals. Sort by channel ascending.

Tables available

Table Columns
orders order_id, customer_id, order_date, status, channel
order_items order_id, product_id, quantity, unit_price

Compute the median over order totals, not over individual line items.

⌘/Ctrl + Enter to grade

Write a query, then grade it.

Hints

Try it first. Reveal a hint only when you are stuck.