The pricing team wants to find loans whose interest rate exceeds the average rate for their loan type. Use a correlated subquery. Return loan id, loan_type, interest_rate, and the type_avg_rate rounded to 2 decimals. Sort by interest_rate descending. Limit to 25.
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