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

  1. Join order lines to products.
  2. Filter completed orders.
  3. 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.