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.
Schema
🔑idINT
🔗customer_idINT
loan_typeTEXT
principalREAL
interest_rateREAL
term_monthsINT
start_dateTEXT
statusTEXT
postgresql
Run your query to see results
Press Ctrl + Enter to execute