Tables: Accounts
, Transactions
, Customers
.
- Tasks:
- Find customers with highest balance.
- Monthly withdrawals and deposits.
- Fraud detection (same account multiple withdrawals in short time).
SELECT AccountID, SUM(CASE WHEN Type='Deposit' THEN Amount ELSE 0 END) AS TotalDeposits,
SUM(CASE WHEN Type='Withdraw' THEN Amount ELSE 0 END) AS TotalWithdrawals
FROM Transactions
GROUP BY AccountID;
Leave a Reply