DoorDash ranks drivers by speed each day. A delivery's duration is the whole minutes from picked_up_at to delivered_at, and it belongs to the calendar date of picked_up_at, even if it is delivered after midnight. Deliveries that were never completed (delivered_at is NULL) are ignored. For each day, average each driver's durations and rank drivers with DENSE_RANK, where the lowest average is rank 1 and equal averages share a rank. Write an SQL query that returns delivery_date, driver_id, avg_minutes rounded to 2 decimal places, and speed_rank. Order the results by delivery_date, then speed_rank, then driver_id.
Loading…
Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.
Ask questions, share alternate queries, and explore solutions
Your recent query executions and answer checks
This will insert the verified MySQL solution into your editor so you can study how each clause transforms the table.