Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Find Largest Funnel Step Drop-Off

MediumSQL · PostgreSQL00:00
I
Practice interviewer
Your interviewer
In session
I
Interviewer

Welcome to the SQL screen.

The question is on your right: Find Largest Funnel Step Drop-Off. Read through the requirements and the three tables first.

Run and submit your code as often as you need. You also have five interviewer messages this session - want to talk through your approach, or are you ready to start coding?

You need to log in / sign up to run or submit.

Problem

StreamFlow tracks users moving through a signup funnel. Write a SQL query to identify the biggest drop-off between consecutive funnel steps for each funnel version.

Requirements

  1. Consider only events where completed_flag = true.
  2. Count distinct users who completed each step within each funnel version.
  3. Compare each step to the immediately previous step in the same funnel version.
  4. Return the step with the largest user drop-off per funnel version, including the previous step name, current step name, previous step users, current step users, drop_off_users, and drop_off_rate.

Schema

funnel_steps
ColumnTypeDescription
step_idPKINTUnique step identifier
funnel_versionVARCHAR(20)Funnel version label
step_nameVARCHAR(50)Name of the funnel step
step_orderINTStep position within the funnel
users
ColumnTypeDescription
user_idPKINTUnique user identifier
acquisition_channelVARCHAR(30)Marketing acquisition source
signup_dateDATEDate the user signed up
funnel_events
ColumnTypeDescription
event_idPKINTUnique event identifier
user_idINTUser who triggered the event
step_idINTFunnel step reached
event_timeTIMESTAMPTime of the event
completed_flagBOOLEANWhether the step was completed
Tablesfunnel_stepsusersfunnel_events
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results