Hard
SQL-W09sqlCumulative Distinct Users
Problem
Given `events(d, user_id)`, output (d, cumulative_distinct_users) — the count of distinct users who have appeared on or before day d.
Input
events
Output
d, cum_distinct
Constraints
1 ≤ rows ≤ 10^6
Sample input
see prompt
Sample output
...
Explanation
First-ever appearance per user → distinct on first_d → running count.
window-fnrunning-count@Spotify
Visible test cases
in: see
out: ...
Your solution — run it, use AI if stuck
sql
