Skip to content

Instantly share code, notes, and snippets.

@dmitchell
Last active March 16, 2017 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmitchell/c402ab93e0881effd888f821f8cf7ebc to your computer and use it in GitHub Desktop.
Save dmitchell/c402ab93e0881effd888f821f8cf7ebc to your computer and use it in GitHub Desktop.
sql phone screen question
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