Consumer Lending Analyst Path · Mission 4 of 30Starter

Applications by state

JOIN application fact to customer dim, GROUP BY state with COUNT

The Brief

Rashida OkonkwoFair Lending Compliance Officerconsumer-lending

I'm building the geographic exposure slide for the CRA committee. Count applications by the applicant's home state. Two columns — `state`, `application_count` — and please sort by application_count descending, then state ascending for the tie-break. Skip walk-in apps where customer_id is NULL — I want only the apps tied to an existing customer record.

You'll practice

JOINGROUP BY

Tables & columns available

lending_applicationsfact18 columns
ColumnTypeKey
app_idINTPK
customer_idINTFK → retail_customers
product_idINTFK → retail_products
application_dateTEXT
requested_amountREAL
requested_termINT
loan_purposeTEXT
action_takenINT
denial_reason_1INT
aus_recommendationTEXT
rate_spreadREAL
lien_statusINT
occupancyINT
ethnicityINT
raceINT
sexINT
age_bucketTEXT
property_tractTEXTFK → lending_geography
retail_customersdim13 columns
ColumnTypeKey
customer_idINTPK
household_idTEXT
first_nameTEXT
last_nameTEXT
date_of_birthTEXT
stateTEXT
segmentTEXT
fico_currentINT
estimated_incomeREAL
kyc_riskTEXT
acquisition_channelTEXT
onboarded_dateTEXT
statusTEXT

Hints (3)

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

Hint 1

The state column lives on the customer dim, not on applications — JOIN through `customer_id` to reach it.

Hint 2

Walk-in apps have a NULL customer_id. An INNER JOIN already drops them implicitly; an explicit `IS NOT NULL` filter just makes the population assumption visible. Fair-lending memos always document who's in scope.

Hint 3

Two-key sort: count descending so the headline state leads, then state ascending so equal-count states tie-break alphabetically and the ranking stays deterministic across runs.