Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Monthly Conversion Rate by Channel

MediumSQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is Monthly Conversion Rate by Channel. Start with the requirements and the two tables on the right.

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.

Problem

Business Context

ZoomInfo marketing analysts use website, campaign, and webinar engagement data to evaluate which acquisition channels generate demo requests.

Task

Write a PostgreSQL query that calculates monthly conversion performance by channel from marketing_events. Treat a visitor as converted within a month and channel when they have at least one demo_request event in that same month and channel.

Requirements

  1. Return the month in YYYY-MM format, the channel name, total distinct visitors, converted distinct visitors, and conversion rate as a percentage.
  2. Count each visitor only once per month and channel, even if the visitor has multiple events.
  3. Restrict the analysis to January and February 2025, and exclude events whose channel_id does not match the channels table.
  4. Sort results chronologically by month and alphabetically by channel name.

Schema

marketing_events
ColumnTypeDescription
event_idPKINTUnique marketing event identifier
visitor_idVARCHAR(30)Anonymous or known visitor identifier
channel_idINTMarketing channel associated with the event
occurred_atTIMESTAMPTimestamp when the event occurred
event_typeVARCHAR(30)Type of marketing event
channels
ColumnTypeDescription
channel_idPKINTUnique marketing channel identifier
channel_nameVARCHAR(80)Readable marketing channel name
Tablesmarketing_eventschannels
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results