Interview Query

Campaign Goals

Start Timer

0:00:00

Upvote
6
Downvote
Save question
Mark as completed
View comments (8)
Next question

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. Round output to 4 decimals.

  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

Output

Column Type
campaign_id INTEGER
first_seven_days_average DECIMAL
expected_daily_average DECIMAL
percent_delivered DECIMAL
percent_days_passed DECIMAL
.
.
.
.
.


Comments

Loading comments