Skip to main content
Advancedhow it works

Compute monthly cohort retention from a transactions table.

Source: PostgreSQL: SELECT (clause processing)

Quick answerFree

Step 1: each user's cohort month = month of their first transaction (MIN over the user). Step 2: the distinct months each user was active. Step 3: join them and compute months since the cohort month.

Detailed answer· 73 words

Pro

Unlock the full answer with Pro

Get a 73-word model answer, 4 key points and a visual explainer, plus 307 more SQL questions.

Key points· 4 points

Pro
Unlock with Pro

Visual explainer· animated, step by step

Pro
Unlock with Pro

+ 307 more SQL questions in Pro, each with the full answer.

Discussion