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 Marketing Channel by Revenue
00:00
5 left

Top Marketing Channel by Revenue

MediumSQL · PostgreSQL

Problem

Groupon marketing wants to identify which acquisition channel generated the most recognized revenue from attributed orders. Write a PostgreSQL query using Groupon campaign attribution data.

Requirements

  1. Join marketing channels, campaigns, and orders using their key relationships.
  2. Include only completed orders placed during January 2025, from January 1 through January 31.
  3. Aggregate gross revenue by marketing channel and return the top-performing channel or channels, including ties.
  4. Return channel_name and total_revenue, ordered by revenue descending and channel name ascending.

Schema

marketing_channels
ColumnTypeDescription
channel_idPKINTMarketing channel identifier
channel_nameVARCHAR(80)Groupon marketing channel name
channel_typeVARCHAR(40)Channel classification
campaigns
ColumnTypeDescription
campaign_idPKINTCampaign identifier
channel_idINTReferenced marketing channel
campaign_nameVARCHAR(120)Groupon campaign name
launched_atDATECampaign launch date
orders
ColumnTypeDescription
order_idPKINTOrder identifier
campaign_idINTAttributed campaign
order_dateDATEDate the order was placed
order_statusVARCHAR(20)Order processing status
gross_revenueDECIMAL(12,2)Recognized gross order revenue
Tablesmarketing_channelscampaignsorders
Interviewer

Your question is Top Marketing Channel by Revenue. Start with the requirements and the three 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.