Write a SQL query to analyze weekly restaurant performance by location, including sales, labor cost, and food waste trends.
Use the provided Famous Dave's location, sales, labor, and food-waste data. Return one row for each location and week with available operational data, including week-over-week percentage changes. Treat missing measures as zero for the current week, and return NULL for a percentage change when the prior value is zero or unavailable.
location_name, week_start, sales, labor_cost, food_waste, prior_sales, sales_change_pct, labor_change_pct, waste_change_pctlocation_name, then week_start ascending| Column | Type | Description |
|---|---|---|
| location_idPK | INT | Unique restaurant location identifier |
| location_name | VARCHAR(100) | Famous Dave's restaurant location name |
| Column | Type | Description |
|---|---|---|
| sale_idPK | INT | Unique sales record identifier |
| location_id | INT | Restaurant location associated with the sale |
| sale_date | DATE | Date of the sales record |
| sales_amount | NUMERIC(12,2) | Sales amount recorded for the date |
| Column | Type | Description |
|---|---|---|
| labor_idPK | INT | Unique labor record identifier |
| location_id | INT | Restaurant location associated with labor cost |
| labor_date | DATE | Date of the labor cost record |
| labor_cost | NUMERIC(12,2) | Labor cost recorded for the date |
| Column | Type | Description |
|---|---|---|
| waste_idPK | INT | Unique food waste record identifier |
| location_id | INT | Restaurant location associated with food waste |
| waste_date | DATE | Date of the food waste record |
| waste_cost | NUMERIC(12,2) | Estimated cost of wasted food |