Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
SQL Query for Marketing Data
00:00
5 left

SQL Query for Marketing Data

EasySQL · PostgreSQL

Problem

Can you write a SQL query to extract specific data from a marketing database?

Assume the data is stored in marketing_campaigns. Return only campaigns whose status is Active.

Output

  1. One row per active campaign.
  2. Columns: campaign_name, channel, and budget.
  3. Sort by budget from highest to lowest, with NULL budgets last.

Schema

marketing_campaigns
ColumnTypeDescription
campaign_idPKINTUnique campaign identifier
campaign_nameVARCHAR(150)Name of the marketing campaign
channelVARCHAR(50)Marketing channel used by the campaign
statusVARCHAR(30)Current campaign status
budgetDECIMAL(12,2)Campaign budget
Tablesmarketing_campaigns
Interviewer

Your question is SQL Query for Marketing Data. Start with the requirements and the one table 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
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.