Find transactions whose amount exceeds the average transaction amount for their account's type. Join transactions to accounts to get the type, then use a correlated subquery comparing against the average for that type. Return transaction id, account_type, amount, and the type_avg. Sort by amount DESC. Limit to 30.
Schema
🔑idINT
🔗customer_idINT
account_typeTEXT
balanceREAL
currencyTEXT
opened_atTEXT
statusTEXT
postgresql
Run your query to see results
Press Ctrl + Enter to execute