Your question is Rank Uptime Outliers. Start with the requirements and the two 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.
Waymo Fleet Operations wants to compare autonomous vehicles by their daily operational uptime. Write a PostgreSQL query that aggregates completed operational intervals, ranks vehicles within each service date, and identifies unusually strong performers.
status = 'operational', a non-null end time, and a positive duration.DENSE_RANK() to rank vehicles within each date by total uptime descending.| Column | Type | Description |
|---|---|---|
| vehicle_idPK | INT | Unique vehicle identifier |
| vehicle_label | VARCHAR(30) | Fleet-facing vehicle label |
| model | VARCHAR(30) | Waymo vehicle model |
| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique uptime event identifier |
| vehicle_id | INT | Vehicle associated with the event |
| service_date | DATE | Operational calendar date |
| started_at | TIMESTAMP | Interval start time |
| ended_at | TIMESTAMP | Interval end time, null for incomplete intervals |
| status | VARCHAR(20) | Operational event status |