Welcome to the SQL screen.
The question is on your right: Top Daily Rides by Vehicle. Read through the requirements and the three tables first.
Run and submit your code as often as you need. You also have five interviewer messages this session - want to talk through your approach, or are you ready to start coding?
Waymo operations wants a daily leaderboard of the longest completed rides for each vehicle. Write a SQL query to return the top 3 rides per vehicle for each calendar day.
start_time to derive the ride date.status = 'completed' and distance_miles is not null.(vehicle_id, ride_date) group by distance_miles descending.start_time, then smaller ride_id.| Column | Type | Description |
|---|---|---|
| vehicle_idPK | INT | Unique vehicle identifier |
| vehicle_name | VARCHAR(100) | Display name for the vehicle |
| depot_id | INT | Assigned depot for the vehicle |
| Column | Type | Description |
|---|---|---|
| depot_idPK | INT | Unique depot identifier |
| depot_name | VARCHAR(100) | Depot name |
| Column | Type | Description |
|---|---|---|
| ride_idPK | INT | Unique ride identifier |
| vehicle_id | INT | Vehicle that served the ride |
| start_time | TIMESTAMP | Ride start timestamp |
| end_time | TIMESTAMP | Ride end timestamp |
| distance_miles | DECIMAL(6,2) | Ride distance in miles |
| status | VARCHAR(40) | Ride status such as completed or canceled |