Your question is Join and Rank Top Products. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Sigmoid Analytics wants to compare product performance across sales regions. Write a PostgreSQL query that joins product metadata with sales transactions and returns the highest-revenue products in each region.
| Column | Type | Description |
|---|---|---|
| product_idPK | INT | Unique product identifier |
| product_name | VARCHAR(100) | Product name |
| category | VARCHAR(50) | Product category |
| Column | Type | Description |
|---|---|---|
| sale_idPK | INT | Unique sale identifier |
| product_id | INT | Product associated with the sale |
| region | VARCHAR(50) | Sales region |
| quantity | INT | Number of units sold |
| unit_price | NUMERIC(10,2) | Price per unit |
| sale_date | DATE | Date of the sale |
| status | VARCHAR(20) | Sale processing status |