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

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.