How would you use SQL window functions to calculate a rolling 7-day average of orders per user for MealPal?
Use the provided MealPal users and orders data. Include calendar days with no orders as zero-order days so the average represents a complete seven-day period.
user_id, user_name, order_date, daily_orders, and rolling_7_day_avg.user_id, then order_date.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique MealPal user identifier |
| user_name | VARCHAR(100) | MealPal user's display name |
| VARCHAR(255) | User email address |
| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Unique MealPal order identifier |
| user_id | INT | User who placed the order |
| order_date | DATE | Calendar date when the order was placed |
| status | VARCHAR(20) | Order processing status |