Last active
March 16, 2017 19:08
-
-
Save dmitchell/c402ab93e0881effd888f821f8cf7ebc to your computer and use it in GitHub Desktop.
sql phone screen question
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table keywords | |
( | |
id INT PRIMARY KEY NOT NULL AUTO_INCREMENT, | |
campaign_id INT | |
); | |
create table campaign | |
( | |
id INT PRIMARY KEY NOT NULL AUTO_INCREMENT, | |
name varchar | |
); | |
create table ledger | |
( | |
entry_date timestamp NOT NULL, | |
keyword_id INT, | |
clicks INT, | |
cost float, | |
leads INT | |
) | |
/* write query to return the id, name, and amount spent for the 5 top spending campaigns in August 2016 */ | |
/* given ledger table | |
entry_date | keyword_id | clicks | cost | leads | cpc/bid | cpl | |
yesterday | 1 | 10 | 2.50 | 2 | .25 | 1.25 | |
yesterday | 2 | 1000 | 350.0 | 35 | .35 | 10.0 | |
yesterday | 3 | 300 | 75.0 | 10 | .25 | 7.50 | |
what should you bid today if your objective is cost/leads = 10.0? */ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment