Write a SQL query to analyze weekly store performance by joining sales, inventory, and labor tables and summarizing key operational metrics for vineyard vines. Calculate weekly sales, units sold, inventory on hand, labor hours, labor cost, and sales per labor hour. Preserve sales weeks even when inventory or labor records are missing.
store_id, week_start, total_sales, total_units_sold, inventory_on_hand, labor_hours, labor_cost, and sales_per_labor_hour.week_start, then store_id.| Column | Type | Description |
|---|---|---|
| sale_idPK | INT | Unique sales transaction identifier |
| store_id | VARCHAR(10) | Vineyard Vines store identifier |
| week_start | DATE | Monday starting the reporting week |
| net_sales | DECIMAL(12,2) | Net sales amount for the transaction |
| units_sold | INT | Number of units sold |
| Column | Type | Description |
|---|---|---|
| inventory_idPK | INT | Unique inventory record identifier |
| store_id | VARCHAR(10) | Vineyard Vines store identifier |
| week_start | DATE | Monday starting the reporting week |
| units_on_hand | INT | Units available at the store for the week |
| Column | Type | Description |
|---|---|---|
| labor_idPK | INT | Unique labor record identifier |
| store_id | VARCHAR(10) | Vineyard Vines store identifier |
| week_start | DATE | Monday starting the reporting week |
| labor_hours | DECIMAL(8,2) | Labor hours worked during the week |
| labor_cost | DECIMAL(12,2) | Labor cost for the week |