Entergy analysts need to compare customer energy consumption across service regions and billing months. Write a PostgreSQL query using the customers and energy_usage tables to rank customers by their total monthly usage within each Entergy region.
RANK() partitioned by region and month, with the highest usage receiving rank 1. Preserve ties with the same rank.| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer display name |
| region | VARCHAR(50) | Entergy service region |
| Column | Type | Description |
|---|---|---|
| usage_idPK | INT | Unique usage reading identifier |
| customer_id | INT | Customer identifier associated with the reading |
| usage_date | DATE | Date on which energy usage was recorded |
| kwh_used | NUMERIC(12,2) | Energy consumed in kilowatt-hours |