Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Rank Top Funnel Segments

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

Your question is Rank Top Funnel Segments. 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

Rippling’s growth team wants to identify which user segments convert best through the signup funnel in Rippling HR Cloud. Write a SQL query to find the top converting segments based on users who reached the final funnel step.

Use the tables below to calculate conversion from signup_started to payroll_enabled for each segment.

Requirements

  1. Consider only users whose signup_started_at is in January 2024.
  2. Define a converted user as one who has a payroll_enabled event within 14 days of signup.
  3. Group results by segment_name from the segments table.
  4. Return these columns: segment_name, started_users, converted_users, conversion_rate, and segment_rank.
  5. Only include segments with at least 2 started users.
  6. Rank segments by conversion_rate descending, then converted_users descending.

Schema

users
ColumnTypeDescription
user_idPKINTUnique user identifier
segment_idINTSegment assigned to the user
signup_started_atTIMESTAMPTimestamp when the user started signup
company_countryVARCHAR(50)Country of the company
segments
ColumnTypeDescription
segment_idPKINTUnique segment identifier
segment_nameVARCHAR(100)Segment label
acquisition_channelVARCHAR(50)Primary acquisition channel
funnel_events
ColumnTypeDescription
event_idPKINTUnique event identifier
user_idINTUser tied to the event
event_nameVARCHAR(50)Name of the funnel event
event_timeTIMESTAMPTimestamp when the event occurred
Tablesuserssegmentsfunnel_events
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results