Chapter 9 · Interview Level
47. Loan Payment Coverage Ratio
Hard40 XPFinance
The collections team needs to know what percentage of each loan's principal has been paid off. For each loan, compute total_paid (sum of principal_paid from payments), the original principal, and the coverage_ratio (total_paid / principal * 100, rounded to 1 decimal). Include loan_type and status. Sort by coverage_ratio descending.
Tables
- PKidINT
- FKcustomer_id→ customers.idINT
- loan_typeTEXT
- principalREAL
- interest_rateREAL
- term_monthsINT
- start_dateTEXT
- statusTEXT
- PKidINT
- FKloan_id→ loans.idINT
- payment_dateTEXT
- amountREAL
- principal_paidREAL
- interest_paidREAL
- remaining_balanceREAL
Need help?
Ask Sol
AI tutor — looks at your current query and nudges you, without spoiling the answer.
Solution
Try the hints first — solving it yourself is what makes it stick.