Game Play Analysis III
You can write a query using a subquery and the SUM window function to achieve this. Here’s the query:


Explanation:
 The
SUM
window function is used to calculate the cumulative sum of thegames_played
column for each player (partitioned byplayer_id
).  The
ORDER BY event_date
inside the window function ensures that the cumulative sum is calculated in the order of the login dates for each player.  The final result shows the total number of games played by each player until each login date.