Top driver in each city
A ride-hailing service rewards the best driver in each city. For each city, find the driver with the highest total fare across completed trips. Ignore trips with no assigned driver. Return city, driver_id and the revenue total, ordered by city, then driver id.
Expected output sample
This is what a correct answer looks like — its row count is its own, it doesn't have to match the schema tables.
| city | total | driver_id |
|---|---|---|
| Kazan | 400 | 3 |
| Moscow | 800 | 1 |
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign in