Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Month-Over-Month Engagement Growth

MediumSQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is Month-Over-Month Engagement Growth. Start with the requirements and the two tables on the right.

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.

Problem

Netflix Analytics Engineering needs a regional view of monthly content engagement across the Netflix catalog. Write a PostgreSQL query that calculates total watch minutes and month-over-month growth for each region.

Requirements

  1. Join viewing events to netflix_titles so only events for known titles are included.
  2. Aggregate positive watch minutes by region and calendar month for Q1 2025, excluding events with a missing region.
  3. Use a window function to return the previous reported month’s engagement and calculate percentage growth. Return NULL growth when no prior month exists or the prior value is zero.
  4. Sort the results by region and month in ascending order.

Schema

viewing_events
ColumnTypeDescription
event_idPKINTUnique viewing event identifier
title_idINTReferenced Netflix title identifier
regionVARCHAR(20)Viewer region
viewed_atTIMESTAMPTimestamp when content was watched
watch_minutesINTMinutes watched during the event
netflix_titles
ColumnTypeDescription
title_idPKINTUnique Netflix title identifier
title_nameVARCHAR(150)Netflix movie or series name
content_typeVARCHAR(20)Content classification
Tablesviewing_eventsnetflix_titles
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results