Back to Practice
#0339

Cohort Size by Signup Month

EasySQL15 min10 XP

Problem

Return cohort_month and users_count ordered by cohort_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)

Examples

Example 1
Inputtwo January signups
OutputJanuary cohort size 2

A cohort is usually defined by 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
Inputtwo January signups
Expected[["2026-01",2],["2026-02",1]]

A cohort is usually defined by signup month.

Hidden Test Categories
Empty or missing matchesDuplicate rows or tiesNULL values where the pattern commonly breaks