Challenge: Reconcile Account Balances
Task
Swipe to start coding
Write a SQL query to identify accounts in the balances table where the sum of related transactions in the bank_transactions table does not match the recorded balance.
- For each account in the
balancestable, calculate the sum of all deposits minus all withdrawals from thebank_transactionstable. - Compare this sum to the value in the
balancecolumn of thebalancestable. - Select the
account_idfor accounts where the calculated sum does not equal the recorded balance.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 4. ChapterΒ 4
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 4.55
Challenge: Reconcile Account Balances
Swipe to show menu
Task
Swipe to start coding
Write a SQL query to identify accounts in the balances table where the sum of related transactions in the bank_transactions table does not match the recorded balance.
- For each account in the
balancestable, calculate the sum of all deposits minus all withdrawals from thebank_transactionstable. - Compare this sum to the value in the
balancecolumn of thebalancestable. - Select the
account_idfor accounts where the calculated sum does not equal the recorded balance.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 4. ChapterΒ 4
single