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
SQL: DAU/MAU Ratio
00:00
5 left

SQL: DAU/MAU Ratio

MediumSQL · PostgreSQL

Problem

Meta's Product Growth team uses the AARRR funnel to monitor activation and retention across Instagram Reels, Facebook Groups, and Instagram Save activity. Write a PostgreSQL query that calculates the daily DAU/MAU ratio for the fixed 30-day period from 2025-03-01 through 2025-03-30.

Requirements

  1. Count distinct active users with at least one valid activity event per calendar day as dau.
  2. Count distinct active users with activity during the trailing 30-day period ending on each calendar day as mau.
  3. Return every calendar date in the reporting window, including dates with zero DAU.
  4. Calculate dau_mau_ratio as DAU divided by MAU, rounded to four decimal places. Avoid division by zero.

Schema

users
ColumnTypeDescription
user_idPKVARCHAR(20)Meta user identifier
account_statusVARCHAR(20)Current account state
signup_dateDATEAccount creation date
app_activity_events
ColumnTypeDescription
event_idPKINTUnique activity event identifier
user_idVARCHAR(20)User associated with the event
event_dateDATECalendar date of the event
surfaceVARCHAR(30)Meta product surface
event_nameVARCHAR(30)Recorded activity type
Tablesusersapp_activity_events
Interviewer

Your question is SQL: DAU/MAU Ratio. 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.