Your question is Longest Consecutive Login Streak per User. Start with the requirements and the one table on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
A social media platform tracks user logins and wants to analyze user engagement. Write a SQL query to find the longest consecutive streak of login days for each user.
| Column | Type | Description |
|---|---|---|
| user_id | INT | Unique identifier for the user |
| login_date | DATE | Date of user login |