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
ExperiencesCoaching
New
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess 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
Get started
Channel Conversion Rate Calculation
00:00
5 left

Channel Conversion Rate Calculation

EasySQL · PostgreSQL

Problem

HelloFresh wants a simple view of signup conversion performance by acquisition channel in the US marketing funnel. Write a SQL query to calculate conversion rate by acquisition_channel from a single table.

Requirements

  1. Return one row per acquisition_channel.
  2. Count total visitors and total converted visitors, where a visitor is considered converted when converted_to_subscriber = TRUE.
  3. Calculate conversion rate as converted_visitors / total_visitors, rounded to 4 decimal places.
  4. Exclude rows where acquisition_channel is NULL.
  5. Order results by conversion rate descending, then by acquisition channel ascending.

Schema

hellofresh_web_sessions
ColumnTypeDescription
session_idPKINTUnique session identifier
visitor_idINTUnique visitor identifier
acquisition_channelVARCHAR(50)Marketing channel that brought the visitor to HelloFresh
session_dateDATEDate of the web session
converted_to_subscriberBOOLEANWhether the visitor subscribed during the session
Tableshellofresh_web_sessions
Interviewer

Whenever you're ready, walk me through your approach or go straight to the code. The requirements and the one table are in the Question tab.

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.