Consumer Lending Analyst Path · Mission 20 of 30Hard

Approval gap by LMI tract

JOIN application fact to a geography dim with CASE bucketing for a 2-row LMI vs Non-LMI comparison

The Brief

Rashida OkonkwoFair Lending Compliance Officerconsumer-lending

First slide of the fair-lending memo. Compare approval rate between LMI tracts and non-LMI tracts — that's `lending_geography.lmi_flag = 1` vs `0`. Four columns: `tract_type` (the string 'LMI' or 'Non-LMI'), `total_apps`, `approved_count`, `approval_rate` (4 decimals). Sort by `tract_type` descending so 'Non-LMI' (the comparison baseline) lists first.

You'll practice

Multi-table JOINCASESubset comparison

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
lending_geographydim6 columns
ColumnTypeKey
tract_idTEXTPK
msa_codeTEXT
countyTEXT
stateTEXT
lmi_flagINT
minority_pctREAL

Hints (3)

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

Hint 1

JOIN applications to `lending_geography` on the tract key. INNER JOIN drops apps with NULL property_tract — auto and personal loans, which are out of scope for HMDA-style geographic analysis anyway.

Hint 2

Translate the integer LMI flag into the human-readable label the slide expects. CASE is the typical idiom; the same expression goes in both the SELECT projection and the GROUP BY so they stay in sync.

Hint 3

Conditional aggregation for approved_count, COUNT(*) for total_apps, ratio for approval_rate (same shape as M6 / M11). Sort tract_type descending so the control group leads the slide — that's just how the lex-sort falls out for these two labels.