Rank Branches by Application Approval Rate Within Each State
Last updated: November 29, 2026
Quick Overview
Given tables of loan applications and branches, write SQL that reports, for the last full quarter, each branch's application count, approval rate and funded amount, and ranks branches by approval rate within their state while excluding branches with fewer than 50 applications.
OneMain Financial
November 29, 20260
0
0 solved
Given tables of loan applications and branches, write SQL that reports, for the last full quarter, each branch's application count, approval rate and funded amount, and ranks branches by approval rate within their state while excluding branches with fewer than 50 applications.
OneMain still originates most loans through roughly 1,300 branches across 44 states, and operations leaders compare branches within a state because pricing and regulation differ by state. This screen checks basic joins, conditional aggregation, HAVING, and window ranking.
What the Interviewer Expects
- Join applications to branches to get state
- Use conditional aggregation for approvals and funded amount
- Filter low-volume branches with HAVING, not WHERE
- Rank with a window function partitioned by state
- Define the quarter boundaries explicitly and explain the approval definition
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you adjust for branches that see a riskier applicant mix?
- Should an application that was approved but never funded count as approved?
- How would you show the trend quarter over quarter for each branch?
- Why might RANK and DENSE_RANK give different answers here?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
Assume applications(app_id, branch_id, applied_at TIMESTAMP, decision VARCHAR, funded_amount NUMERIC) with decision in {APPROVED, DECLINED, WITHDRAWN} and funded_amount null when not funded, plus `b...
Approach
Filter by date, join to branches, aggregate per branch with SUM(CASE ...) for approvals, keep branches with at least 50 decided applications, then RANK within state by approval rate descending....