Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
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
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess 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
Build my plan
Common Pre-Churn User Paths
00:00
5 left

Common Pre-Churn User Paths

HardSQL · PostgreSQL

Problem

Given a table of user events, how do you identify the most common path a user takes before churning at Superhuman?

Use the provided user and event data. Treat a user's path as all non-null events occurring before that user's churn timestamp, ordered chronologically.

Output

  1. Return one row for the most common path, with ties resolved alphabetically.
  2. Include path and churned_users, representing the event sequence and number of churned users following it.
  3. Sort by churned_users descending, then path ascending.

Schema

users
ColumnTypeDescription
user_idPKINTUnique Superhuman user identifier
emailVARCHAR(255)User email address
churned_atTIMESTAMPTimestamp when the user churned, or NULL for active users
user_events
ColumnTypeDescription
event_idPKINTUnique event identifier
user_idINTUser associated with the event
event_nameVARCHAR(100)Name of the event recorded in Superhuman
event_timestampTIMESTAMPTime when the event occurred
Tablesusersuser_events
Interviewer

Your question is Common Pre-Churn User Paths. Start with the requirements and the two tables 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
Sign up free to run your codeLog inLn 1
Run your query to see results here.