Monthly Active Users
Beginner Mode
Objective
Write a SQL query to calculate the number of monthly active users (MAUs) for February 2026.
Table Schema:
- user_actions
| Column | Type | Description |
|---|---|---|
| user_id | INTEGER | ID of the user |
| event_id | INTEGER | Unique identifier for each event |
| event_type | VARCHAR | Type of action ('sign-in', 'like', 'comment') |
| event_date | DATE | Date when the action occurred |
Task Requirements:
- An active user is someone who performed at least one action in both February 2026 and January 2026
- Any action type (sign-in, like, or comment) counts as activity
- A user performing multiple actions in the same month still counts as one active user
- Output the month in numerical format (2 for February)
Output columns: month, monthly_active_users
Examples
Example 1:
Output:
Input:
| user_actions | |||
|---|---|---|---|
| event_date | event_id | event_type | user_id |
| 2026-01-15 | 1 | sign-in | 1 |
| 2026-02-10 | 2 | like | 1 |
| 2026-01-20 | 3 | comment | 2 |
| 2026-02-05 | 4 | sign-in | 2 |
| 2026-02-08 | 5 | like | 3 |
| 2026-01-25 | 6 | sign-in | 4 |
| 2026-01-10 | 7 | like | 5 |
| 2026-01-28 | 8 | comment | 5 |
| 2026-02-20 | 9 | sign-in | 5 |
| month | monthly_active_users |
|---|---|
| 2 | 3 |
Code Environment
Sign in or try as guest to run your code.
Track
| Question | Difficulty | Company | Access |
|---|
Need more practice in this area? Explore more questions →
Meta