P16SQLBeginnerInterpret10 min
Revenue by Product Category
Summarize completed sales by product category for a merchandising report.
#group-by#revenue#aggregation
Scenario
A retailer wants category-level revenue from completed order lines.
Problem statement
Return each category and its completed revenue, highest first.
Your Task
- Join order lines to products.
- Filter completed orders.
- Aggregate at the category grain.
Tables
orders(order_id, status)
order_lines(order_id, product_id, quantity, unit_price)
products(product_id, category)
Related Concepts
JoinsRevenue metricsData grain
Ready to count this problem?
Mark it complete when you have reasoned through the solution in your own words.