Your question is Users Exposed to Multiple Campaigns. Start with the requirements and the three 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.
Netflix marketing analytics needs to identify members who saw multiple active campaigns during the same calendar week. Write a PostgreSQL query that deduplicates repeated exposures to the same campaign before counting campaigns.
DATE_TRUNC('week', exposed_at).active.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Netflix member identifier |
| VARCHAR(255) | Member email address |
| Column | Type | Description |
|---|---|---|
| exposure_idPK | INT | Exposure event identifier |
| user_id | INT | Referenced member |
| campaign_id | INT | Referenced campaign |
| exposed_at | TIMESTAMP | Timestamp when the campaign was shown |
| channel | VARCHAR(50) | Netflix marketing surface or channel |
| Column | Type | Description |
|---|---|---|
| campaign_idPK | INT | Campaign identifier |
| campaign_name | VARCHAR(150) | Campaign name |
| status | VARCHAR(20) | Campaign lifecycle status |