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
Cohort Rolling Conversion Rate
00:00
5 left

Cohort Rolling Conversion Rate

HardSQL · PostgreSQL

Problem

GoDaddy wants to monitor conversion performance for customers who begin using products such as Websites and Domains. Write a PostgreSQL query that calculates a 7-day rolling conversion rate for each customer cohort and active event date.

Requirements

  1. Join customer cohort data with funnel events using user_id.
  2. Calculate daily distinct visitors and daily distinct converters for each cohort_date and event_date. A non-null converted_at indicates a conversion.
  3. Use window functions to calculate rolling 7-day visitors and converters within each cohort. The window must include the current date and the previous six calendar days, even when some dates have no activity.
  4. Return the rolling conversion rate, rounded to four decimal places, and order results by cohort and event date.

Only cohort dates with at least one funnel event are required in the output.

Schema

users
ColumnTypeDescription
user_idPKINTUnique customer identifier
cohort_dateDATEDate the customer entered the cohort
product_nameVARCHAR(100)GoDaddy product associated with the customer
funnel_events
ColumnTypeDescription
event_idPKINTUnique funnel event identifier
user_idINTCustomer who generated the event
event_dateDATEDate of funnel activity
converted_atTIMESTAMPConversion timestamp, or NULL when the event did not convert
Tablesusersfunnel_events
Interviewer

Your question is Cohort Rolling Conversion Rate. 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.