Skip to main content
← All prompts

SQL retention cohort query (Postgres)

Category: code

Prompt
Write a PostgreSQL 16 query that produces a weekly retention cohort grid for a users + events table (events has user_id, event_type, created_at). Columns: cohort_week, week_0..week_12 as percentages.
Rubric

Correct cohort logic, efficient (uses generate_series), readable CTE layout.

No receipts for this prompt yet. An admin can trigger a run from the Outputs Queue.