They ask you two SQL questions, one easy and one hard. How do you handle both?
Write PostgreSQL queries using the provided customers and orders tables. The easy result summarizes completed orders for every customer. The hard result returns customers with at least two completed orders and ranks them within their region by completed spend.
question_level, customer_name, total_completed_spend, completed_order_count, and region_rank.question_level, then customer_name.| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer display name |
| region | VARCHAR(50) | Customer region |
| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Unique order identifier |
| customer_id | INT | Customer associated with the order |
| status | VARCHAR(20) | Order lifecycle status |
| amount | NUMERIC(10,2) | Order amount |