Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

January Rider Retention Rate

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

Your question is January Rider Retention Rate. Start with the requirements and the two 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

Uber wants to measure early rider retention for users who signed up in January 2024. Write a SQL query to calculate the retention rate for that signup cohort.

Define a retained rider as a rider who signed up in January 2024 and completed at least one trip in February 2024.

Requirements

  1. Identify all riders whose signup_date falls between 2024-01-01 and 2024-01-31.
  2. Count how many riders are in that January 2024 signup cohort.
  3. Count how many of those riders completed at least one trip in February 2024.
  4. Return the cohort month, cohort size, retained riders, and retention rate as a percentage rounded to 2 decimals.

Schema

riders
ColumnTypeDescription
rider_idPKINTUnique rider identifier
rider_nameVARCHAR(100)Rider full name
signup_dateDATEDate the rider signed up for Uber
cityVARCHAR(50)Primary signup city
trips
ColumnTypeDescription
trip_idPKINTUnique trip identifier
rider_idINTRider who requested the trip
trip_dateDATEDate of the trip
trip_statusVARCHAR(20)Trip outcome such as completed or canceled
fare_usdNUMERIC(8,2)Final trip fare in USD
Tablesriderstrips
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results