Write a SQL query to analyze weekly operational performance by region at Medzed, joining orders and staffing tables and calculating a rolling 4-week average. Include completed orders and staffing hours for every region-week represented in either table. Treat weeks as starting on Monday and avoid division by zero.
region, week_start, completed_orders, staffed_hours, orders_per_staff_hour, and rolling_4_week_avg.region, then week_start ascending.| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Unique order identifier |
| region | VARCHAR(50) | Medzed operating region |
| order_date | DATE | Date the order was created |
| status | VARCHAR(20) | Order lifecycle status |
| Column | Type | Description |
|---|---|---|
| staffing_idPK | INT | Unique staffing record identifier |
| region | VARCHAR(50) | Medzed operating region |
| staffing_date | DATE | Date staffing was recorded |
| staffed_hours | DECIMAL(10,2) | Available staff hours |