Simple Solution With DATEDIFF, MIN
Intuition\nFirst mark the record as 1 if it\'s for a return login, then use sum to count the number of return player and devided by total number of distinct pla
# Intuition\nFirst mark the record as 1 if it\'s for a return login, then use sum to count the number of return player and devided by total number of distinct player.\n\n# Code\n```\n# Write your MySQL query statement below\n\nSELECT ROUND(SUM(login)/COUNT(DISTINCT player_id), 2) AS fraction\nFROM (\n  SELECT\n    player_id,\n    DATEDIFF(event_date, MIN(event_date) OVER(PARTITION BY player_id)) = 1 AS login\n  FROM Activity\n) AS t\n```
['MySQL']