Skip to main content
Admissions guidance, study banks, and career tools โ€” get started on Shalyam

Longest Consecutive Login Streak

For each user return the length of their longest streak of consecutive login days. Each user logs at most once per day in the table. Order by user_id.

Table schema

Logins(user_id INT, login_date DATE)

Sample data

user_id | login_date
1 | 2026-03-01
1 | 2026-03-02
1 | 2026-03-03
1 | 2026-03-05
1 | 2026-03-06
2 | 2026-03-01
2 | 2026-03-03

Discussion

No discussions yet.

Rewards ยท v2.1

Join Shalyam Newsletter

Get exclusive insights with every issue: education, research and innovation news.

One email a week. Unsubscribe any time.