Monthly Active Users
Meta ☯️ Medium SQL
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:

Input:

user_actions
event_dateevent_idevent_typeuser_id
2026-01-151sign-in1
2026-02-102like1
2026-01-203comment2
2026-02-054sign-in2
2026-02-085like3
2026-01-256sign-in4
2026-01-107like5
2026-01-288comment5
2026-02-209sign-in5

Output:
monthmonthly_active_users
23
Quick Solution

Code Environment

Sign in or try as guest to run your code.

Sign In

Track

Question Difficulty Company Access
Need more practice in this area? Explore more questions →