Skip to main content
All Problems
hard0% acceptance

Detect Suspicious Large Withdrawal Patterns

Flag accounts where a single withdrawal exceeds 1.5 times the account's average withdrawal amount. Return account_id, the suspicious transaction id (txn_id), the withdrawal amount, and the account's avg_withdrawal (rounded to 2 decimals). Use a CTE to compute average withdrawals per account, then join back. Order by amount descending.

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