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

Instagram Reels DAU/MAU Ratio

MediumSQL · PostgreSQL

Problem

Meta’s Instagram Reels team tracks stickiness using the DAU/MAU ratio. Write a SQL query to compute this ratio for each of the past 30 days using Reels engagement activity.

For this question, define:

  • DAU = distinct users active on that calendar day
  • MAU = distinct users active in the 30-day rolling window ending on that day
  • DAU/MAU ratio = dau / mau

Use the reels_events table below.

Requirements

  1. Return one row per day for the past 30 days ending on 2024-06-30.
  2. Count a user as active if they generated at least one event on Instagram Reels that day.
  3. For each day, compute the rolling 30-day MAU ending on that day.
  4. Return activity_date, dau, mau, and dau_mau_ratio rounded to 4 decimal places.
  5. Order the output by activity_date ascending.

Schema

reels_events
ColumnTypeDescription
event_idPKINTPrimary key for each Reels event
user_idINTMeta user identifier
event_nameVARCHAR(50)Type of Instagram Reels event
event_timeTIMESTAMPTimestamp when the event occurred
surfaceVARCHAR(50)Meta product surface where the event happened
country_codeVARCHAR(2)Two-letter country code
Tablesreels_events
Interviewer

Whenever you're ready, walk me through your approach or go straight to the code. The requirements and the one table are in the Question tab.

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.