Practice · medium · dataset: ecom
Top products by units sold
Find the five products with the highest total quantity sold across all order line items. Return
product_id, name, and units_sold.
Sort by units_sold descending, then by product_id ascending.
Tables available
| Table | Columns |
|---|---|
products |
product_id, name, category, unit_price |
order_items |
order_id, product_id, quantity, unit_price |
Count units from the quantity column, not the number of line items or orders.
⌘/Ctrl + Enter to grade
Write a query, then grade it.
Hints
Try it first. Reveal a hint only when you are stuck.