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
Retention Rate SQL Query
00:00
5 left

Retention Rate SQL Query

MediumSQL · PostgreSQL

Problem

Remitly wants to measure how consistently newly registered customers complete transfers after signup. Write a PostgreSQL query to calculate monthly retention for the January 2024 signup cohort.

Requirements

  1. Treat users who signed up from 2024-01-01 through 2024-01-31 as the cohort.
  2. Calculate retention for months 0, 1, and 2, where month 0 is January 2024.
  3. Count each user at most once per month, even if they complete multiple transfers.
  4. Return the cohort size, retained users, and retention rate, using all cohort users as the denominator. Order by month number.

Schema

users
ColumnTypeDescription
user_idPKINTUnique Remitly customer identifier
signup_dateDATEDate the customer registered
country_codeVARCHAR(2)Customer registration country
remitly_transfers
ColumnTypeDescription
transfer_idPKINTUnique transfer identifier
user_idINTCustomer who initiated the transfer
completed_atTIMESTAMPTransfer completion timestamp
channelVARCHAR(20)Transfer initiation channel
Tablesusersremitly_transfers
Interviewer

Your question is Retention Rate SQL Query. 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.