Mock interview. You're interviewing for a senior ads analyst job on a visual discovery app. The interviewer says: "Advertisers pay for every click. We want to show them which campaigns earn their money back, and suggest where to move budget."
ad_events has one row per impression, click or checkout. Checkout rows carry the revenue the advertiser made.cost_per_click for every valid click."Before any money maths: a click should always come after the person saw that campaign's ad. List clicks with no impression from the same user and campaign at or before the click time."
Expected output
event_id, campaign_id, user_id, event_ts; sorted by event_idExample of the shape (made-up values):
| event_id | campaign_id | user_id | event_ts |
|---|---|---|---|
| 1234 | 5 | 99 | 2026-04-02 10:00:00 |
Hints, the later steps and the answer come with Pro.
Step 1 of 4
Write your query here. Ctrl + Enter submits.