Write a SQL query to analyze warehouse performance by site, shift, and day, including throughput, accuracy, and labor cost per unit. Use the provided warehouse, shift, and operation data. Include only valid site and shift combinations with positive processed units.
Output
- One row per site, shift, and operation date.
- Columns:
site_name, shift_name, operation_date, throughput, accuracy_pct, and labor_cost_per_unit.
- Sort by site name, operation date, and shift name.
Output details
- Compute
throughput as the sum of units_processed for each site, shift, and operation date.
- Compute
accuracy_pct as 100 times summed accurate_units divided by summed units_processed, treating NULL accurate_units as 0.
- Compute
labor_cost_per_unit as summed labor_cost divided by summed units_processed, treating NULL labor_cost as 0.
- Round
accuracy_pct and labor_cost_per_unit to 2 decimal places.
- Sort
site_name, operation_date, and shift_name in ascending order.