Amazon's category managers want a units-sold report by department. Every department must appear, even if none of its products have sold, in which case it shows 0. Units come from order_items.quantity. Write an SQL query that returns department_name and units_sold. Order the results by units_sold descending, then department_name 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.