Your question is Rolling 30-Day Average Performance. 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.
Tatari analysts need to monitor campaign performance over time. Write a PostgreSQL query that calculates a rolling 30-day average of each active campaign's daily conversion rate.
campaigns to campaign_daily_performance and include only active campaigns with performance dates from January 1 through February 10, 2025.NULL when impressions are zero or missing.| Column | Type | Description |
|---|---|---|
| campaign_idPK | INT | Unique campaign identifier |
| campaign_name | VARCHAR(100) | Tatari campaign name |
| status | VARCHAR(20) | Campaign lifecycle status |
| channel | VARCHAR(40) | Primary advertising channel |
| Column | Type | Description |
|---|---|---|
| performance_idPK | INT | Unique daily performance record identifier |
| campaign_id | INT | References campaigns.campaign_id |
| performance_date | DATE | Date represented by the performance record |
| impressions | INT | Number of delivered impressions |
| conversions | INT | Attributed conversions |