Explore Library
Quiz

Assigning Cohorts With Window Functions

Choosing the right window expression to tag every order row with the customer's first-purchase cohort.

You have an `orders` table (customer_id, order_month, amount) and want to tag EVERY order row with the customer's cohort — the month of their first-ever order — so you can later compute retention per cohort. Which expression correctly assigns the cohort on every row in a single pass?