Given a schema of user play events, write a query to identify the top three most-played songs per user over a rolling seven-day window at Spotify.
Use each user's distinct play-event date as a window end date. A window includes plays from that date and the preceding six calendar days. Exclude incomplete events with NULL user, song, or timestamp values.
Output
- One row per ranked user, window end date, and song
- Columns:
user_id, display_name, window_end_date, song_id, song_title, play_count, and song_rank
- Include only the top three songs per user and window, ordered by play count descending, song ID ascending for ties, then user ID and window date