Skip to main content
All Problems
hard0% acceptance

Transaction Type Pivot by Account

The analytics team wants a pivot-style report showing each account's total amount broken down by transaction type. Return account_id, total_deposits, total_withdrawals, total_transfers, total_fees, and total_interest. Use conditional aggregation. Sort by account_id. Limit to 30 rows.

Schema

🔑idINT
🔗account_idINT
transaction_dateTEXT
typeTEXT
amountREAL
balance_afterREAL
descriptionTEXT
reference_numberTEXT
postgresql

Run your query to see results

Press Ctrl + Enter to execute