Skip to main content
All Problems
hard0% acceptance

Detect Suspicious Transaction Patterns

The fraud team wants to find transactions whose amount is more than 1.5 times the average for their transaction type. Use a CTE to compute the average amount per type. Then join to flag above-average transactions. Return the transaction id, account_id, type, amount, and the type average (type_avg, rounded to 2 decimals). Sort 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