About the “Monthly User Cohort Retention Matrix” SQL Problem
Business Scenario
The holy grail of product-market fit is Cohort Retention: tracking whether users who signed up in month M come back and remain active in month M+1, M+2, etc.
Expected Output & Criteria
Cohort table displaying cohort_month, activity_month, and active_users.
Database Table Schema (PostgreSQL DDL)
PostgreSQL 16 WASMThis challenge executes directly against the following relational schema in your browser:
CREATE TABLE cohort_users (
user_id INT PRIMARY KEY,
signup_date DATE NOT NULL
);
CREATE TABLE user_events (
event_id INT PRIMARY KEY,
user_id INT REFERENCES cohort_users(user_id),
event_date DATE NOT NULL
);Target SQL Clauses & Operators
DATE_TRUNCGROUP BY
Want more Business Analytics practice?
Explore the full syllabus of 14 exercises, syntax guides, and interview pitfalls.