Last Updated: May 12, 2026
For this exercise, we will work with below data:
Write a query that returns each user's distinct streaming dates from the streams table. Show user_id and stream_date, ordered by user_id and stream_date.
Write a query that returns all listening streaks for every user, grouping consecutive days into islands using the ROW_NUMBER difference technique. Show user_id, streak_start, streak_end, and streak_days. Order by user_id, streak_start.
Write a query that returns the longest single streak across all users. Show username, streak_start, streak_end, and streak_days. If multiple users tie for the longest streak, include all of them. Order by username, streak_start.