Your question is Rolling 7-Day Click-Through Rate. Start with the requirements and the one table 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.
Cisco monitors ad engagement across its digital advertising surfaces. Given ad event data, write a PostgreSQL query that calculates each user's rolling 7-day click-through rate by event date.
NULL when the rolling impression count is zero.user_id and event_date.| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique ad event identifier |
| user_id | INT | Cisco user identifier |
| event_ts | TIMESTAMPTZ | Timestamp at which the ad event occurred |
| event_type | VARCHAR(20) | Event classification, such as click or impression |