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
Top Ad Campaigns by Conversion
00:00
5 left

Top Ad Campaigns by Conversion

MediumSQL · PostgreSQL

Problem

InMobi Product Analytics needs to compare campaign efficiency across the InMobi Exchange. Write a PostgreSQL query to identify the five campaigns with the highest conversion rate during January 2025.

Requirements

  1. Join campaign metadata with daily performance data.
  2. Aggregate January impressions, clicks, and conversions by campaign.
  3. Define conversion rate as conversions divided by clicks, expressed as a percentage. Treat NULL conversions as zero and exclude campaigns with zero total clicks.
  4. Return the top five campaigns, ordered by conversion rate descending and campaign ID ascending to break ties.

Schema

campaigns
ColumnTypeDescription
campaign_idPKINTUnique campaign identifier
campaign_nameVARCHAR(120)Campaign name
advertiserVARCHAR(100)Advertiser or agency name
campaign_daily_performance
ColumnTypeDescription
performance_idPKINTUnique daily performance record
campaign_idINTReferenced campaign identifier
performance_dateDATEReporting date
impressionsINTNumber of ad impressions
clicksINTNumber of ad clicks
conversionsINTNumber of attributed conversions
Tablescampaignscampaign_daily_performance
Interviewer

Your question is Top Ad Campaigns by Conversion. Start with the requirements and the two 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.