logins(user_id, logged_in_at)
Return the user_id of everyone who logged in on seven or more consecutive
calendar days, ordered by user_id.
Several logins on one day are one day. A user who manages two separate long runs should still appear once.
Gaps and islands: subtract a row number from the date, and a run of consecutive days collapses to a single constant.
Tables
logins
user_id logged_in_at
------- -------------------
10 2026-04-01 08:00:00
10 2026-04-02 08:00:00
10 2026-04-03 08:00:00
10 2026-04-03 20:00:00
10 2026-04-04 08:00:00
10 2026-04-05 08:00:00
10 2026-04-06 08:00:00
10 2026-04-07 08:00:00
... 26 more row(s)
Expected result
user_id
-------
10
12