Write a SQL query to analyze store operations performance by week, joining sales, inventory, and labor tables to identify locations with high shrink and low recovery scores at Michaels.
Use a shrink rate above 2% and a recovery score below 70 as the identification thresholds. Include prior-week comparisons when available.
store_id, week_start, net_sales, shrink_value, shrink_rate, recovery_score, labor_hours, prior_week_shrink_rate, and recovery_score_change.week_start ascending, shrink_rate descending, and store_id ascending.| Column | Type | Description |
|---|---|---|
| sale_idPK | INT | Unique sale identifier |
| store_id | INT | Michaels store identifier |
| sale_date | DATE | Date of the sale |
| net_sales | NUMERIC(12,2) | Net sales amount |
| Column | Type | Description |
|---|---|---|
| inventory_idPK | INT | Unique inventory record identifier |
| store_id | INT | Michaels store identifier |
| inventory_date | DATE | Date of the inventory observation |
| shrink_value | NUMERIC(12,2) | Value of inventory shrink |
| recovery_score | NUMERIC(5,2) | Inventory recovery score from 0 to 100 |
| Column | Type | Description |
|---|---|---|
| labor_idPK | INT | Unique labor record identifier |
| store_id | INT | Michaels store identifier |
| labor_date | DATE | Date the labor was recorded |
| hours_worked | NUMERIC(8,2) | Labor hours worked |