Practice · medium · dataset: ecom
Orders above average value
Find orders whose total line-item value exceeds the average order value across all orders. Total
value is the sum of quantity times the line’s unit_price for that order.
Return order_id, customer_id, and order_total rounded to two decimals. Sort by order_total
descending, then by order_id ascending.
Tables available
| Table | Columns |
|---|---|
orders |
order_id, customer_id, order_date, status, channel |
order_items |
order_id, product_id, quantity, unit_price |
Every order in the dataset has at least one line item. Compare each order to the average across all orders, not to a customer-specific average.
⌘/Ctrl + Enter to grade
Write a query, then grade it.
Hints
Try it first. Reveal a hint only when you are stuck.