Write a query using a self-join to track sequential events in a vehicle telemetry log. Return each event with the next chronological event for the same vehicle and the elapsed time between them. An event is sequential only when no other event for that vehicle occurs between the two events.
vehicle_id, current_event_id, current_event_type, current_event_time, next_event_id, next_event_type, next_event_time, and seconds_to_next.vehicle_id, current_event_time, and current_event_id ascending.| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique telemetry event identifier |
| vehicle_id | VARCHAR(20) | Vehicle identifier associated with the event |
| event_time | TIMESTAMP | Timestamp when the telemetry event occurred |
| event_type | VARCHAR(40) | Telemetry event classification |