Write a SQL query to report daily shipment volume, on-time delivery rate, and average order cycle time by facility at McKesson.
Use the provided facility, order, and shipment data. Treat on-time rate as the percentage of delivered shipments delivered on or before the promised date. Calculate cycle time only for delivered shipments.
Output
- One row per facility and shipment date.
- Return
facility_code, shipped_date, shipment_volume, on_time_delivery_rate_pct, and avg_order_cycle_time_days.
- Include shipment dates represented in the data, sort by
facility_code, then shipped_date ascending.