Your question is Top Customers Per Region SQL. 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.
Engie Impact needs a regional view of its highest-consuming customers. Write a PostgreSQL query that aggregates energy consumption by month and ranks customers within each region.
customer_id.| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer display name |
| region | VARCHAR(50) | Customer's operating region |
| Column | Type | Description |
|---|---|---|
| reading_idPK | INT | Unique energy reading identifier |
| customer_id | INT | Customer associated with the reading |
| reading_date | DATE | Date on which consumption was recorded |
| consumption_kwh | DECIMAL(12,2) | Energy consumption in kilowatt-hours |