Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

SQL for Day 7 Retention

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

Your question is SQL for Day 7 Retention. 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

The Product Analytics team for Scopely's Monopoly GO! wants to measure whether players from a specific signup cohort return to the game seven days later. Write a PostgreSQL query for users who signed up on 2025-01-10.

Requirements

  1. Restrict the cohort to Monopoly GO! users whose signup date is 2025-01-10.
  2. Count each cohort user once, even if they generate multiple events on Day 7.
  3. Treat a user as retained when they have at least one game event on 2025-01-17.
  4. Return the cohort date, cohort size, retained users, and retention rate as a percentage rounded to two decimal places.

Schema

users
ColumnTypeDescription
user_idPKINTEGERUnique player identifier
game_nameVARCHAR(30)Scopely game name
signup_atTIMESTAMPPlayer signup timestamp
platformVARCHAR(20)Player platform
game_events
ColumnTypeDescription
event_idPKINTEGERUnique game event identifier
user_idINTEGERPlayer who generated the event
activity_atTIMESTAMPEvent timestamp
event_typeVARCHAR(30)Type of game activity
Tablesusersgame_events
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results