Your question is Rolling 7-Day Audience Average. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
The Nielsen needs a daily audience trend for Nielsen measurement regions. Write a PostgreSQL query that calculates a calendar-day rolling average for each region.
| Column | Type | Description |
|---|---|---|
| region_idPK | INT | Unique region identifier |
| region_name | VARCHAR(80) | Nielsen measurement region name |
| Column | Type | Description |
|---|---|---|
| observation_idPK | INT | Unique audience observation identifier |
| region_id | INT | References regions.region_id |
| audience_date | DATE | Date of the audience measurement |
| audience_count | INT | Observed audience count |