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
ExperiencesCoaching
New
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess 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
Get started
Host Retention Rate Query
00:00
5 left

Host Retention Rate Query

MediumSQL · PostgreSQL

Problem

Write a SQL query to calculate the retention rate of hosts over a specific period on Turo.

Use January 2024 as the cohort period and February 2024 as the retention period. Count a host in the cohort if they completed at least one trip in January, and count them as retained if they completed at least one trip in February.

Output

  1. Return one row for the January 2024 cohort.
  2. Include cohort_period, cohort_hosts, retained_hosts, and retention_rate_pct.
  3. Return the retention rate as a percentage rounded to two decimal places.

Schema

hosts
ColumnTypeDescription
host_idPKINTUnique identifier for the host
host_nameVARCHAR(100)Host display name
marketVARCHAR(50)Primary Turo market for the host
created_atDATEDate the host joined Turo
trips
ColumnTypeDescription
trip_idPKINTUnique identifier for the trip
host_idINTHost associated with the trip
trip_startDATETrip start date
statusVARCHAR(20)Trip status
Tableshoststrips
Interviewer

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