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
Running Total of Daily Signups
00:00
5 left

Running Total of Daily Signups

MediumSQL · PostgreSQL

Problem

DeFiner wants a reliable daily signup trend for its analytics dashboard. Write a PostgreSQL query that reports daily signups during February 1 through February 10, 2025, including days with no qualifying signups.

Requirements

  1. Count distinct users whose signup event occurred on each calendar day.
  2. Exclude test users, deleted users, users without a recognized acquisition channel, duplicate signup events, and events outside the requested date range.
  3. Calculate the previous day's signup count with LAG.
  4. Calculate the cumulative signup total with a windowed SUM ordered by date.
  5. Return one row per calendar day in ascending date order.

Schema

users
ColumnTypeDescription
user_idPKINTUnique DeFiner user identifier
created_atTIMESTAMPAccount creation timestamp
channel_idINTAcquisition channel identifier
is_testBOOLEANWhether the account is a test account
deleted_atTIMESTAMPAccount deletion timestamp
signup_events
ColumnTypeDescription
event_idPKINTUnique event identifier
user_idINTUser associated with the event
event_typeVARCHAR(30)Tracked event name
occurred_atTIMESTAMPTimestamp when the event occurred
acquisition_channels
ColumnTypeDescription
channel_idPKINTUnique acquisition channel identifier
channel_nameVARCHAR(100)Human-readable acquisition channel
is_activeBOOLEANWhether the channel is currently active
Tablesuserssignup_eventsacquisition_channels
Interviewer

Your question is Running Total of Daily Signups. Start with the requirements and the three 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.