Skip to main content
All Problems
medium0% acceptance

Monthly Deposit and Withdrawal Totals

Create a monthly report showing total deposits and total withdrawals side by side. Return the month (as YYYY-MM), total_deposits, and total_withdrawals. Use conditional aggregation (CASE inside SUM). Order by month ascending.

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