Your question is Rank Top Vehicle Configurations. 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.
Mercedes-Benz Group uses vehicle telemetry to compare configuration performance across development and fleet vehicles. Write a PostgreSQL query to identify the three best-performing configurations during January 2025.
2025-01-01 through 2025-01-31, inclusive.RANK() to rank configurations by cumulative distance in descending order, return ranks 1 through 3, and order the final result by rank.| Column | Type | Description |
|---|---|---|
| configuration_idPK | INT | Configuration identifier |
| configuration_code | VARCHAR(20) | Mercedes-Benz configuration code |
| model_name | VARCHAR(80) | Vehicle model name |
| powertrain | VARCHAR(30) | Powertrain type |
| Column | Type | Description |
|---|---|---|
| vehicle_idPK | INT | Vehicle identifier |
| configuration_id | INT | Referenced configuration |
| vin | VARCHAR(17) | Vehicle identification number |
| fleet_status | VARCHAR(20) | Current fleet status |
| Column | Type | Description |
|---|---|---|
| telemetry_idPK | INT | Telemetry record identifier |
| vehicle_id | INT | Referenced vehicle |
| recorded_at | DATE | Date of telemetry capture |
| distance_km | DECIMAL(10,2) | Distance measured in kilometers |
| energy_consumed_kwh | DECIMAL(10,2) | Energy consumed in kilowatt-hours |