Practice · medium · dataset: ecom
Revenue share by order status
Finance wants revenue broken down by order status, plus each status’s share of total revenue.
Revenue is quantity times the line’s unit_price.
Return status, revenue rounded to two decimals, and share_pct rounded to two decimals. The
share is a percentage of total revenue across all statuses. Sort by revenue descending, then by
status ascending.
Tables available
| Table | Columns |
|---|---|
orders |
order_id, customer_id, order_date, status, channel |
order_items |
order_id, product_id, quantity, unit_price |
Include every line item, whatever the order status. The percentages should add up to approximately 100 after rounding.
⌘/Ctrl + Enter to grade
Write a query, then grade it.
Hints
Try it first. Reveal a hint only when you are stuck.