Write a SQL query to analyze store performance by joining sales, inventory, and staffing data, and return the key business KPIs by week at Staples India.
Use the supplied tables and calculate metrics at store-week grain, preserving sales weeks even when supporting data is unavailable.
store_code, week_start, weekly_revenue, units_sold, average_inventory, stockout_days, labor_hours, sales_per_labor_hour, and revenue_change_pct.NULL where appropriate.store_code, then week_start ascending.| Column | Type | Description |
|---|---|---|
| sale_idPK | INT | Unique sales transaction identifier |
| store_code | VARCHAR(10) | Staples India store code |
| sale_date | DATE | Date of the sale |
| revenue | DECIMAL(12,2) | Revenue generated by the transaction |
| units_sold | INT | Number of units sold |
| Column | Type | Description |
|---|---|---|
| inventory_idPK | INT | Unique inventory observation identifier |
| store_code | VARCHAR(10) | Staples India store code |
| inventory_date | DATE | Date of the inventory observation |
| inventory_units | INT | Units available at the observation time |
| Column | Type | Description |
|---|---|---|
| staffing_idPK | INT | Unique staffing record identifier |
| store_code | VARCHAR(10) | Staples India store code |
| staffing_date | DATE | Date of the staffing record |
| labor_hours | DECIMAL(8,2) | Total labor hours recorded |