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 for Engagement at Scale
00:00
5 left

SQL for Engagement at Scale

HardSQL · PostgreSQL

Problem

Write a performant SQL query to aggregate user engagement metrics across billions of rows of gaming telemetry.

Use the provided users, games, and telemetry_events tables. Include only non-bot users, valid game records, and telemetry from January and February 2025.

Output

  1. One row per month and user region.
  2. Columns: month_start, region, active_users, sessions, telemetry_events, play_minutes, wins, matches, win_rate, and active_user_change_pct.
  3. Include regions with activity, retain NULL regions, sort by month and region with NULL regions last, and calculate the percentage change from the previous month for each region.

Schema

users
ColumnTypeDescription
user_idPKBIGINTUnique Discord user identifier
usernameVARCHAR(80)Discord username
regionVARCHAR(20)User's operational region
created_atTIMESTAMPTZAccount creation timestamp
is_botBOOLEANWhether the account is an automated bot
games
ColumnTypeDescription
game_idPKBIGINTUnique game identifier
game_nameVARCHAR(120)Game title
genreVARCHAR(40)Game genre
telemetry_events
ColumnTypeDescription
event_idPKBIGINTUnique telemetry event identifier
user_idBIGINTUser who generated the event
game_idBIGINTReferenced game
session_idVARCHAR(40)Gaming session identifier
event_tsTIMESTAMPTZEvent occurrence timestamp
event_typeVARCHAR(40)Telemetry event type
duration_secondsINTEGERDuration associated with the event
event_valueVARCHAR(40)Event outcome or categorical value
Tablesusersgamestelemetry_events
Interviewer

Your question is SQL for Engagement at Scale. 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.