Retail Banking Operations Path · Mission 14 of 30Medium

Dormant account audit (180+ days silent)

LEFT JOIN + HAVING with date math

The Brief

Sarah ReyesCustomer Insights Leadretail-ops

Quarterly dormancy review. Anchor date is 2025-12-01. I want every Open account whose last posted transaction was more than 180 days before the anchor — that's last_post < '2025-06-04'. EXCLUDE accounts that have never transacted at all (those are a different escheatment workstream). Return `account_id`, `customer_id`, `product_subcategory`, and `last_txn_date`, sorted by last_txn_date ascending so the deepest dormancy lands at the top of the queue.

You'll practice

LEFT JOINHAVINGDate math

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_transactionsfact12 columns
ColumnTypeKey
txn_idINTPK
account_idINTFK → retail_accounts
branch_idINTFK → retail_branches
post_dateTEXT
channelTEXT
transaction_typeTEXT
debit_creditTEXT
amountREAL
descriptionTEXT
counterparty_nameTEXT
is_cash_flagINT
is_reversalINT
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

Each account's last activity is the maximum post_date across the transactions table. LEFT JOIN account → transactions so accounts with zero transactions survive the join, then aggregate per account.

Hint 2

Open status only — closed accounts aren't dormant, they're closed. Bring product_subcategory in via a join to retail_products for the output column.

Hint 3

The dormancy filter belongs in HAVING because it references the per-account aggregate. Two conditions ANDed: the max post_date is not NULL (excludes never-transacted) AND it's strictly before the cutoff date the briefing gave.