How would you identify the top 5% of loan applicants based on their credit score within each state at American Credit Acceptance?
Write a SQL query using the provided applicant, application, and state reference data. Exclude applicants without a credit score and include applicants whose score meets or exceeds their state's 95th percentile cutoff.
Output
- One row per qualifying applicant, with
applicant_id, applicant_name, state_code, state_name, credit_score, state_percentile_cutoff, and state_rank.
- Sort by
state_code, descending credit_score, then applicant_id.