Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Month-over-Month Creator Retention
00:00
5 left

Month-over-Month Creator Retention

MediumSQL · PostgreSQL

Problem

Given a database of user video interactions, write a SQL query to calculate the month-over-month retention rate of active creators.

Use the creators and video_interactions tables. A creator is active in a month when they have at least one recorded interaction during that month.

Output

  1. One row per month after the first observed month, with columns month_start, previous_month_active_creators, retained_creators, and retention_rate.
  2. Include creators active in both the current month and immediately preceding month in retained_creators.
  3. Order by month_start ascending. Return retention_rate as a percentage rounded to two decimal places.

Schema

creators
ColumnTypeDescription
creator_idPKINTUnique creator identifier
creator_nameVARCHAR(100)Creator display name
video_interactions
ColumnTypeDescription
interaction_idPKINTUnique interaction identifier
creator_idINTCreator associated with the interaction
interaction_atTIMESTAMPTimestamp when the interaction occurred
Tablescreatorsvideo_interactions
Interviewer

Your question is Month-over-Month Creator Retention. Start with the requirements and the two 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.