Game Play Analysis IV

4pts
Epic Games

Problem Statement

Epic Games wants to calculate the Day 1 Retention Rate. This is the fraction of players that logged in again on the day immediately after the day they first logged in, rounded to 2 decimal places.

In other words, you need to count the number of players that logged in for at least two consecutive days starting from their first login date, then divide that number by the total number of players.

Rules:

  • The result column should be named fraction.
  • The result should be rounded to 2 decimal places.
  • A player's first login is the record with the earliest event_date for that player_id.
Tests your understanding of
Basic SQL, Aggregation, Subqueries and Date Arithmetic

Input Tables

activity
player_id(INTEGER)device_id(INTEGER)event_date(DATE)games_played(INTEGER)
122016-03-015
122016-03-026
232017-06-251
312016-03-020
342018-07-035
122016-03-0510
452020-01-012
452020-01-023
562020-05-101
562020-05-121
672020-06-011
672020-06-024

Expected Output

fraction(DECIMAL)
0.5

Tags

MediumBasic SQLAggregationSubqueriesDate Arithmetic
20-25 min
35%

Hints