Write a SQL query using window functions to rank locations by throughput within each region.
Use the locations and throughput_records tables. Include locations without throughput records, treating their total throughput as zero.
region_name, location_name, total_throughput, and throughput_rank.| Column | Type | Description |
|---|---|---|
| location_idPK | INT | Unique identifier for the location |
| region_name | VARCHAR(50) | Region containing the location |
| location_name | VARCHAR(100) | Operational location name |
| Column | Type | Description |
|---|---|---|
| record_idPK | INT | Unique throughput record identifier |
| location_id | INT | Location associated with the throughput record |
| record_date | DATE | Date when throughput was recorded |
| throughput_units | INT | Number of units processed |