SQL: Active Users
Medium
SQL — Advanced
SQL
DATE
Window Functions
Find users active on 5+ consecutive days.
Constraints
Write standard SQL (MySQL 8.0 compatible).
Examples
Example 1:
Input: user_id date
1 2024-01-01
1 2024-01-02...
Output:
Example 2:
Input: user_id date
1 2024-01-01
1 2024-01-02...
Output:
Hints
Date manipulation with self-join or window functions.
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console