BETWEEN on maturity_date with multi-table JOIN
Treasury wants to plan retention offers ahead of Q2. Pull every CD account maturing in the next 90 days from today (today = 2026-04-29, so the window is 2026-04-29 through 2026-07-28 inclusive). I need `account_id`, `product_name`, `maturity_date`, `original_balance`, and `interest_rate`. Sort by maturity date ascending so I can bucket the wall by week. Pull from `retail_accounts` joined to `retail_products`, filtered to the CD subcategory.
| Column | Type | Key |
|---|---|---|
| account_id | INT | PK |
| customer_id | INT | FK → retail_customers |
| product_id | INT | FK → retail_products |
| branch_id | INT | FK → retail_branches |
| open_date | TEXT | |
| close_date | TEXT | |
| status | TEXT | |
| ownership_type | TEXT | |
| interest_rate | REAL | |
| original_balance | REAL | |
| credit_limit | REAL | |
| fico_at_orig | INT | |
| maturity_date | TEXT |
| Column | Type | Key |
|---|---|---|
| product_id | INT | PK |
| product_code | TEXT | |
| product_name | TEXT | |
| category | TEXT | |
| subcategory | TEXT | |
| default_apr | REAL | |
| default_apy | REAL | |
| monthly_fee | REAL | |
| nsf_fee | REAL | |
| od_fee | REAL |
Each hint you reveal reduces the XP you can earn. Try the query first.
CDs live in `retail_accounts` but the human-readable `product_name` is in `retail_products` — join them on `product_id`. Filter the subcategory to CDs only.
The maturity window is a BETWEEN on `maturity_date` — `'2026-04-29' AND '2026-07-28'` covers exactly 90 days inclusive of both endpoints.
Five columns in the order Jordan listed. Sort by `maturity_date` ascending so the earliest-maturing CDs are first — that's the order Treasury wants for the retention call list.