Chapter 4 · Aggregations
60. Average Loan Principal by Loan Type
Medium20 XPFinance
The risk team needs the average principal amount for each loan type. Return loan_type, the count of loans, and the average principal rounded to 2 decimals (avg_principal). Only include loan types with more than 5 loans. Sort by avg_principal descending.
Tables
- PKidINT
- FKcustomer_id→ customers.idINT
- loan_typeTEXT
- principalREAL
- interest_rateREAL
- term_monthsINT
- start_dateTEXT
- statusTEXT
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.