Back to Practice
#0392
Retention Matrix Cell
HardSQL35 min25 XP
Problem
Return cohort_month and month_1_active_users for users active in the month after their signup month.
Why This Matters
SQL interviews usually test whether you can turn a business question into the right rows, grouping level, join type, and edge-case behavior.
Schema
users(user_id INTEGER, signup_date TEXT); events(user_id INTEGER, event_date TEXT)
Examples
Example 1
InputJan cohort has one February active user
Output2026-01 -> 1
The event month is compared to the month after signup month.
Constraints
- Return only the requested columns.
- Use deterministic ORDER BY when multiple rows are returned.
- Assume SQLite-compatible SQL unless the prompt states otherwise.
CodeSQL
Visible browser tests run here when available.
Testcases1 visible / 3 hidden categories
Core SQL case
InputJan cohort has one February active user
Expected[["2026-01",1],["2026-02",1]]
The event month is compared to the month after signup month.
Hidden Test Categories
Empty or missing matchesDuplicate rows or tiesNULL values where the pattern commonly breaks