Write a few CTEs to query a dataset at different levels of granularity. Asked in the technical screen stage. Basic SQL exercise.
region and product_category, plus an overall total row.region, product_category, order_count, total_revenue, and avg_order_value.region, then product_category.| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Unique order identifier |
| region | VARCHAR(50) | Sales region |
| product_category | VARCHAR(50) | Product category |
| order_status | VARCHAR(20) | Order lifecycle status |
| order_amount | NUMERIC(10,2) | Order revenue amount |