Write a SQL query to analyze warehouse performance by shift, including total orders processed, average cycle time, and on-time shipment rate at Schneider. Use processed orders only. Include every defined shift, including shifts with no processed orders, and calculate the shipment rate only for processed orders with both shipment and promised timestamps.
Output
- One row per shift, ordered by
shift_id ascending.
- Columns:
shift_id, shift_name, total_orders_processed, average_cycle_time_minutes, and on_time_shipment_rate.
- Return the rate as a percentage from 0 to 100, and return NULL for metrics that cannot be calculated.