Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
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 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
Build my plan
Dashers Week-Over-Week Retention SQL
00:00
5 left

Dashers Week-Over-Week Retention SQL

MediumSQL · PostgreSQL

Problem

Write a SQL query to calculate the retention rate of Dashers week-over-week.

Use the dashers and dasher_deliveries tables. A Dasher is active in a week if they completed at least one delivery during that week.

Output

  1. One row per week that follows a week with active Dashers
  2. Columns: week_start, retained_dashers, prior_week_dashers, and retention_rate_pct
  3. Include Dashers active in the prior week in the denominator, and Dashers active in both weeks in the numerator
  4. Round the retention rate to two decimal places and order by week_start ascending

Schema

dashers
ColumnTypeDescription
dasher_idPKINTUnique identifier for a Dasher
signup_dateDATEDate the Dasher signed up
is_activeBOOLEANWhether the Dasher account is currently active
dasher_deliveries
ColumnTypeDescription
delivery_idPKINTUnique identifier for a delivery
dasher_idINTDasher who handled the delivery
delivery_dateDATEDate the delivery was completed or attempted
statusVARCHAR(20)Delivery status, such as completed or cancelled
Tablesdashersdasher_deliveries
Interviewer

Your question is Dashers Week-Over-Week Retention SQL. 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.