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
Daily Active Users and Churn
00:00
5 left

Daily Active Users and Churn

MediumSQL · PostgreSQL

Problem

Wish wants a daily engagement report for users interacting with the Wish marketplace. Using the tables below, write a PostgreSQL query for activity from January 1 through January 5, 2025.

Requirements

  1. Return one row for every date in the reporting period, including dates with no activity.
  2. Calculate daily_active_users as the distinct number of registered users with at least one activity event on that date.
  3. Calculate daily_churned_users as users active on the previous day who have no activity on the current day. Do not count users who were not active on the previous day.
  4. Return rows ordered chronologically by activity_date.

Deduplicate multiple activity events from the same user on the same date before calculating either metric.

Schema

users
ColumnTypeDescription
user_idPKINTEGERUnique Wish user identifier
display_nameVARCHAR(100)User display name
activity
ColumnTypeDescription
activity_idPKINTEGERUnique activity event identifier
user_idINTEGERUser associated with the activity event
activity_dateDATECalendar date of the activity event
event_typeVARCHAR(40)Type of marketplace activity
Tablesusersactivity
Interviewer

Your question is Daily Active Users and Churn. 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.