Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Unify Campaign Performance Sources
00:00
5 left

Unify Campaign Performance Sources

MediumSQL · PostgreSQL

Problem

You are asked to build a unified monthly campaign report by combining lead data from Salesforce, email engagement from Marketo, and web sessions from Google Analytics. Write a PostgreSQL query that returns one row per campaign for January 2024, showing the campaign name, total leads created, number of MQLs, total email sends, total email clicks, total web sessions, and a derived campaign_status that is Healthy when the campaign has at least 2 MQLs and a click-through rate of at least 10%; otherwise mark it Needs Review. Include campaigns even if they are missing data from one of the sources.

Schema

campaigns
ColumnTypeDescription
campaign_idPKINTUnique campaign identifier
campaign_nameVARCHAR(100)Campaign name
salesforce_leads
ColumnTypeDescription
lead_idPKINTUnique lead identifier
campaign_idINTAssociated campaign identifier
created_atDATELead creation date
lead_statusVARCHAR(20)Lead lifecycle status
marketo_email_stats
ColumnTypeDescription
stat_idPKINTUnique email stat record identifier
campaign_idINTAssociated campaign identifier
activity_dateDATEEmail activity date
sendsINTEmail sends for the record
clicksINTEmail clicks for the record
ga_campaign_sessions
ColumnTypeDescription
session_idPKINTUnique session record identifier
campaign_idINTAssociated campaign identifier
session_dateDATEWeb session date
sessionsINTNumber of sessions
Tablescampaignssalesforce_leadsmarketo_email_statsga_campaign_sessions
Interviewer

Your question is Unify Campaign Performance Sources. Start with the requirements and the four tables in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
Sign up free to run your codeLog inLn 1
Run your query to see results here.