Write a SQL query to find the average transit time of vehicles moving between inspection centers and local delivery hubs at Carvana.
Use the facility and transit movement data provided. Include only completed, positive-duration movements whose origin is an inspection center and destination is a local delivery hub.
inspection_center, delivery_hub, and avg_transit_hoursinspection_center, then delivery_hub| Column | Type | Description |
|---|---|---|
| facility_idPK | INT | Unique facility identifier |
| facility_name | VARCHAR(100) | Display name of the facility |
| facility_type | VARCHAR(40) | Facility classification |
| Column | Type | Description |
|---|---|---|
| movement_idPK | INT | Unique transit movement identifier |
| vehicle_id | VARCHAR(20) | Vehicle identifier |
| origin_facility_id | INT | Facility where the movement began |
| destination_facility_id | INT | Facility where the movement ended |
| departed_at | TIMESTAMP | Vehicle departure timestamp |
| arrived_at | TIMESTAMP | Vehicle arrival timestamp |