logo

Oracle NextGen

score

SQL Challenge

Challenge #11 – Consecutive Login Streak

Challenge Overview
Find users who have logged in for at least 3 consecutive days and show their longest streak.

Requirements

  • Return columns: user_id, username, longest_streak.
  • Identify consecutive login dates.
  • Calculate the longest consecutive streak for each user.
  • Only show users with streaks of 3 or more days.
  • Order by longest_streak descending.
Sample Dataset
Preview the schema and seeded rows you can query against.

users

User accounts.

Columns
NameTypeNotes
user_idINTPrimary key
usernameVARCHARUsername
Sample Rows
user_idusername
1alice123
2bob456
3charlie789

logins

User login history.

Columns
NameTypeNotes
login_idINTPrimary key
user_idINTForeign key
login_dateDATELogin date
Sample Rows
login_iduser_idlogin_date
112024-01-01
212024-01-02
312024-01-03
412024-01-04
522024-01-01
622024-01-03
732024-01-01
832024-01-02
932024-01-03
SQL Playground
Loading editor…

Result Preview

Awaiting Run

Run your query to see the dataset preview.