Retail Banking Operations Path · Mission 18 of 30Hard

2025 closed-account exit cohort with tenure

Cohort definition with date arithmetic

The Brief

Sarah ReyesCustomer Insights Leadretail-ops

I'm building the 2025 attrition deck. Pull every account that closed in calendar 2025 (close_date in 2025) and show its tenure in days. Five columns: `account_id`, `customer_id`, `product_subcategory`, `open_date`, `close_date`, `tenure_days` (close_date − open_date as an integer). Sort by close_date descending, then account_id ascending. The tenure number drives the cohort exit-rate-by-tenure-band analysis the deck builds on.

You'll practice

Cohort definitionDate arithmetic

Tables & columns available

retail_accountsdim13 columns
ColumnTypeKey
account_idINTPK
customer_idINTFK → retail_customers
product_idINTFK → retail_products
branch_idINTFK → retail_branches
open_dateTEXT
close_dateTEXT
statusTEXT
ownership_typeTEXT
interest_rateREAL
original_balanceREAL
credit_limitREAL
fico_at_origINT
maturity_dateTEXT
retail_productsdim10 columns
ColumnTypeKey
product_idINTPK
product_codeTEXT
product_nameTEXT
categoryTEXT
subcategoryTEXT
default_aprREAL
default_apyREAL
monthly_feeREAL
nsf_feeREAL
od_feeREAL

Hints (3)

Each hint you reveal reduces the XP you can earn. Try the query first.

Hint 1

The cohort is `close_date BETWEEN '2025-01-01' AND '2025-12-31'` — no NULL close_date filter needed because BETWEEN excludes NULLs in standard SQL.

Hint 2

Tenure in days is `close_date::date - open_date::date` in Postgres — that returns an integer count of days. Cast both columns since they're stored as TEXT.

Hint 3

Six columns in the order Sarah listed. ORDER BY close_date DESC, then account_id ASC for a stable secondary sort. Watch for any negative tenure values — those are data-quality bugs worth flagging.