Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Analyze Signup Funnel Drop-Off

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

Your question is Analyze Signup Funnel Drop-Off. Start with the requirements and the three 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

StreamFlow wants to measure where users drop off in its onboarding funnel. Write a PostgreSQL query to calculate how many users reached each funnel step and how many dropped before the next step within a 7-day window from signup.

Requirements

  1. Treat the funnel as: landing_view  signup_started  email_verified  subscription_started.
  2. Count each user at most once per step, using their earliest event timestamp for that step.
  3. Only include users who signed up between 2024-01-01 and 2024-01-31.
  4. A step counts only if it happened on or after signup and within 7 days of the user's signup date.
  5. Return one row per funnel step with:
    • users who reached the step
    • users who dropped before the next step
    • drop-off percentage from that step to the next

Schema

users
ColumnTypeDescription
user_idPKINTUnique user identifier
signup_dateDATEDate the user registered
acquisition_channelVARCHAR(50)Marketing acquisition source
funnel_steps
ColumnTypeDescription
step_namePKVARCHAR(50)Name of the funnel step
step_orderINTStep sequence in the funnel
events
ColumnTypeDescription
event_idPKINTUnique event identifier
user_idINTUser who generated the event
event_nameVARCHAR(50)Event type corresponding to a funnel step or other action
event_timeTIMESTAMPTime the event occurred
device_typeVARCHAR(20)Device used for the event
Tablesusersfunnel_stepsevents
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results