SQL
All Top 50 SQL Interview Questions#30
User Daily Active Engagement Counts in SQL
EasyInterview Question #30
From a `user_events` table, calculate how many distinct calendar days each `user_id` interacted with the application during the month of February 2026. Only include users with at least 3 active days.
Input Table: user_events
4 rows preview| event_id | user_id | created_at |
|---|---|---|
| 1 | 101 | 2026-02-01 10:00:00 |
| 2 | 101 | 2026-02-01 15:00:00 |
| 3 | 101 | 2026-02-03 12:00:00 |
| 4 | 101 | 2026-02-05 09:00:00 |
Expected Output Structure1 rows
| user_id | active_days |
|---|---|
| 101 | 3 |
Interview Context
Asked frequently in data analyst and business analyst technical rounds. Focus on clean filtering, optimal indexing usage, and unambiguous column selection.
PostgreSQL 15
Ready to execute
Click "Run Query" or press Ctrl + Enter to test your query.
Output will be verified against the test dataset.