SQL business case: product performance
The buying team reviews the range every quarter and needs four answers: what each product sold, how the categories compare, which product leads each category, and which products have never been part of a paid order.
Four exercises across products, order lines and orders, with the paid filter in the right place each time.
Step 1: Units and revenue per product
- Product performance, step 1: units and revenue per productYou are reviewing the catalog. For every product sold in at least one paid order, return name, total quantity sold as units, and revenue (quantity times price), counting paid orders only.
Step 2: Revenue per category
- Product performance, step 2: revenue per categoryRoll product revenue up to categories. For each category with paid sales, return category, units and revenue, counting paid orders only.
Step 3: Best seller in each category
- Product performance, step 3: best seller in each categoryFor each category, return category, name and revenue of the product with the highest paid revenue in that category.
Step 4: Products with no paid sales
- Product performance, step 4: products with no paid salesClose the review with the dead stock. Return the name of every product that has never been part of a paid order.
Other plans and cases
- 14-day SQL interview sprint (41)
- SQL for data analyst interviews (24)
- SQL for BI analyst interviews (21)
- SQL for data engineer interviews (24)
- Product analytics SQL in four sessions (12)
- SQL traps and time periods in three sessions (10)
- Window functions in six sessions (18)
- SQL on messy data: one work week (16)
- PostgreSQL features in four sessions (11)
- SQL business case: the refund review (5)
- SQL business case: the payroll review (5)
- SQL business case: the monthly revenue report (4)
- SQL business case: customer value and segments (4)
- All exercises by level
Your first 8 exercises are free, with no account, from any plan or level. Progress is kept in this browser; a free account keeps it on every device.