The executive team needs a quick overview of the loan portfolio. For each loan status (active, paid, defaulted), return the status, the count of loans, the total principal, and the average interest rate rounded to 2 decimals. Sort by total_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