Calculating User Sessions And Retention Rates With SQL Queries
Calculate user sessions: 10min inactivity or 5min logout. Count players scoring 3x in a row within 1min. Track daily active users & next-day retention rate of new users.
01 - User Session Count User behavior data table A session is considered over if a user does not take any action within 10 minutes, or if they do not log in within 5 minutes after logging out. Calculate the number of sessions for each user. Copy Code 02 - Count the players who score 3 times in a row within 1 minute Score table of a ball game Copy Code 03 - Calculate the number of users who are active for three consecutive days within every 7 days User login data table Copy code 04 - Calculate the next-day retention rate of new users per day User login data table Copy code 05 - Calculat...