SQLSQL
#29

Day 1 User Retention Rate in SQL

MediumGoogle
Interview Question #29
Asked at Google

Given an `activity` table (player_id, device_id, event_date, games_played), calculate Day-1 retention: the fraction of players who logged in on the day immediately following their first login date, rounded to 2 decimal places.

Input Table: activity
5 rows preview
player_idevent_date
12026-03-01
12026-03-02
22026-06-25
32026-07-03
32026-07-05
Expected Output Structure1 rows
fraction
0.33
Interview Context

Asked frequently in data analyst and business analyst technical rounds. Focus on clean filtering, optimal indexing usage, and unambiguous column selection.

SQLPostgreSQL 15
Ready to execute

Click "Run Query" or press Ctrl + Enter to test your query.

Output will be verified against the test dataset.

Chat with us