Write a SQL query to analyze warehouse performance by site, shift, and day, including throughput, accuracy, and labor cost per unit.
Use the supplied warehouse, shift performance, and labor tables. Include valid warehouse-site records across all available dates.
site_code, work_date, shift_name, throughput_units, accuracy_percentage, and labor_cost_per_unit.site_code, work_date, and shift_name ascending. Return NULL when a metric cannot be calculated.| Column | Type | Description |
|---|---|---|
| site_idPK | INT | Unique warehouse identifier |
| site_code | VARCHAR(10) | Operational warehouse code |
| site_name | VARCHAR(100) | Warehouse name |
| Column | Type | Description |
|---|---|---|
| performance_idPK | INT | Unique performance record identifier |
| site_id | INT | Warehouse identifier |
| shift_name | VARCHAR(20) | Operational shift name |
| work_date | DATE | Date of the shift |
| units_processed | INT | Units processed during the shift |
| units_accurate | INT | Units processed accurately |
| Column | Type | Description |
|---|---|---|
| labor_entry_idPK | INT | Unique labor entry identifier |
| site_id | INT | Warehouse identifier |
| shift_name | VARCHAR(20) | Operational shift name |
| work_date | DATE | Date of the labor entry |
| labor_hours | NUMERIC(8,2) | Paid labor hours |
| hourly_rate | NUMERIC(8,2) | Hourly labor rate |