Practice Interview Questions
| Question | Status |
|---|---|
We have a table named user_login that records each user's daily login dates.
Write a SQL query to identify users who have logged in for at least 10 consecutive days. For each occurrence of such a pattern, display the user_id and the first date of these 10 consecutive days.
Example Scenario:
user_login table:
| Column Name | Description |
|---|---|
| user_id | Identifier for each user |
| login_date | The date and time when the user logged in |
| first_login_date |
|---|
| 1032 | 2019-01-01 |
We have a table named user_login that records each user's daily login dates.
Write a SQL query to identify users who have logged in for at least 10 consecutive days. For each occurrence of such a pattern, display the user_id and the first date of these 10 consecutive days.
Example Scenario:
user_login table:
| Column Name | Description |
|---|---|
| user_id | Identifier for each user |
| login_date | The date and time when the user logged in |
| user_id | first_login_date |
|---|---|
| 1032 | 2019-01-01 |