How would you model a dataset that requires both high-frequency sensor updates and long-term historical analysis at Waymo?
For this exercise, write a SQL query that summarizes readings during the specified two-day period while retaining vehicles without qualifying readings. The result must also identify the most recent qualifying reading for each vehicle.
vehicle_id ascending.vehicle_id, vehicle_name, reading_count, average_speed_mps, maximum_temperature_c, and latest_reading_at.| Column | Type | Description |
|---|---|---|
| vehicle_idPK | INT | Unique Waymo vehicle identifier |
| vehicle_name | VARCHAR(80) | Human-readable vehicle label |
| fleet_status | VARCHAR(30) | Current fleet status |
| Column | Type | Description |
|---|---|---|
| reading_idPK | BIGINT | Unique sensor reading identifier |
| vehicle_id | INT | Vehicle associated with the reading |
| recorded_at | TIMESTAMPTZ | UTC timestamp when the reading was recorded |
| sensor_type | VARCHAR(40) | Sensor stream that produced the reading |
| speed_mps | NUMERIC(8,2) | Vehicle speed in meters per second |
| temperature_c | NUMERIC(6,2) | Sensor temperature in degrees Celsius |