Joins and aggregation: three drills
Target skills:
- joining fact and dimension tables
- grouped metrics
- filtering after joins
Easy #
Return each order with the user email and product name, one row per order. Output exactly order_id, email, product_name, and total (alias o.id as order_id and p.name as product_name).
Loading SQL editor...
Medium #
Compute revenue and average review rating per product category — one row per category that has orders. Output exactly category, revenue, and avg_rating, both metrics rounded to 2 decimals with ROUND(..., 2).
Loading SQL editor...
Hard #
For each user (including users with no orders or reviews) return total orders, total spend, and the number of distinct reviewed products. Output exactly user_id, email, total_orders, total_spend (rounded to 2 decimals), and reviewed_products. Users with no activity must show 0, not NULL.
Loading SQL editor...