SQL
All Top 50 SQL Interview Questions#29
Day 1 User Retention Rate in SQL
MediumGoogleInterview Question #29
Asked at GoogleGiven 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_id | event_date |
|---|---|
| 1 | 2026-03-01 |
| 1 | 2026-03-02 |
| 2 | 2026-06-25 |
| 3 | 2026-07-03 |
| 3 | 2026-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.
PostgreSQL 15
Ready to execute
Click "Run Query" or press Ctrl + Enter to test your query.
Output will be verified against the test dataset.