Your question is Top-Selling Products by Region. Start with the requirements and the three 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.
Nike wants to identify the best-selling products in each retail region for the last completed quarter, April 1 through June 30, 2025. Write a PostgreSQL query that summarizes completed sales and ranks products within each region.
sales to products and stores to obtain product names and regions.| Column | Type | Description |
|---|---|---|
| sale_idPK | INT | Unique sale identifier |
| product_id | INT | Referenced Nike product |
| store_id | INT | Referenced Nike store |
| sale_date | DATE | Date of the sale |
| units_sold | INT | Number of units in the sale |
| status | VARCHAR(20) | Transaction status |
| Column | Type | Description |
|---|---|---|
| product_idPK | INT | Unique product identifier |
| product_name | VARCHAR(100) | Nike product name |
| Column | Type | Description |
|---|---|---|
| store_idPK | INT | Unique store identifier |
| store_name | VARCHAR(100) | Nike store name |
| region | VARCHAR(50) | Geographic sales region |