Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Rolling 30-Day MAU Actions Query
00:00
5 left

Rolling 30-Day MAU Actions Query

MediumSQL · PostgreSQL

Problem

Write a SQL query to find the monthly active users (MAU) who have performed a specific set of actions on New Relic's platform over a rolling 30-day period.

Use users, platform_events, and action_catalog. Treat rows marked is_required = TRUE as the required action set. Evaluate each calendar month represented in the events, using the month end as the rolling 30-day window end.

Output

  1. One row per calendar month.
  2. Columns: month_start and mau_user_count.
  3. Include users who completed every required action in that month's rolling window, and order by month_start ascending.

Schema

users
ColumnTypeDescription
user_idPKINTUnique New Relic user identifier
emailVARCHAR(255)User email address
account_tierVARCHAR(50)New Relic account tier
platform_events
ColumnTypeDescription
event_idPKINTUnique platform event identifier
user_idINTUser who performed the action
action_idINTPerformed platform action
event_timestampTIMESTAMPTimestamp when the action occurred
event_metadataTEXTOptional event details
action_catalog
ColumnTypeDescription
action_idPKINTUnique action identifier
action_nameVARCHAR(100)Platform action name
is_requiredBOOLEANWhether the action is required for MAU qualification
descriptionTEXTAction description
Tablesusersplatform_eventsaction_catalog
Interviewer

Your question is Rolling 30-Day MAU Actions Query. 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
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.