Your question is SQL Window Streak of QuickBooks Logins. Start with the requirements and the two tables 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.
Intuit wants to identify continuous daily login streaks for users of QuickBooks. Write a PostgreSQL query that detects each uninterrupted sequence of login dates and excludes streaks shorter than two days.
ROW_NUMBER, LAG, or LEAD to identify consecutive date sequences.| Column | Type | Description |
|---|---|---|
| user_idPK | INTEGER | Unique QuickBooks user identifier |
| display_name | VARCHAR(100) | User's display name |
| VARCHAR(255) | User email address |
| Column | Type | Description |
|---|---|---|
| login_event_idPK | INTEGER | Unique login event identifier |
| user_id | INTEGER | References quickbooks_users.user_id |
| login_date | DATE | Calendar date of the login |
| login_source | VARCHAR(30) | Login channel, when available |