Interview Query

Campaign Goals

3
Have you seen this question before?

Let’s say we have a schema that represents advertiser campaigns and impressions. The campaigns table specifically has a goal, which is the number that the advertiser wants to reach in total impressions. 

  1. Given the table above, generate a daily report that tells us how each campaign delivered during the first 7 days.

  2. Using this data, how do we evaluate how each campaign is delivering and by what heuristic do we surface promos that need attention?

Example:

Input:

ad_impressions table

Column Type
dt DATETIME
user_id INTEGER
campaign_id INTEGER
impression_id VARCHAR

campaigns table 

Column Type
id INTEGER
start_dt DATETIME
end_dt DATETIME
goal INTEGER
Next question: Custom Filter
.....
MySQL 8.0.17
Loading editor
Use Shift + Enter to run query