Write a SQL query to calculate the rolling 7-day average of click-through rates (CTR) for a set of Quantcast campaigns.
Use the supplied campaign, advertiser, and daily campaign metric data. Calculate daily CTR as clicks divided by impressions, then calculate the average across the current date and six preceding calendar days. Exclude non-Quantcast campaigns and dates without metric rows.
Output
- One row per Quantcast campaign and metric date.
- Columns:
campaign_id, campaign_name, metric_date, daily_ctr, and rolling_7_day_ctr.
- Sort by
campaign_id, then metric_date ascending.