Practice Free
HardBusiness Analytics High Frequency

Smurfing Detection: Sub-$10,000 Structured Cash Deposits

Frequently Asked By:StripeCoinbaseBloomberg
Interactive In-Browser Workspace

Practice this problem on live schema tables in PostgreSQL 16 WASM with instant row verification and visual EXPLAIN plans.

Solve in Workbench

Problem Statement

Identify bank accounts in `cash_deposits` that made **at least 2** cash deposits between **$9,000.00** and **$9,999.99**. Calculate: 1. `account_id` 2. `suspicious_deposits_count`: Count of deposits in that range 3. `total_structured_amount`: Sum of `deposit_amount` Filter deposits where `deposit_amount BETWEEN 9000.00 AND 9999.99`. Group by `account_id` and use `HAVING COUNT(*) >= 2`. Order results by `total_structured_amount` descending.

Why Technical Interviewers Ask This

Under the Bank Secrecy Act, financial institutions must report cash deposits of $10,000 or greater (Currency Transaction Report). Money launderers break deposits into chunks just below $10,000 (e.g. $9,000 to $9,999), a felony pattern known as 'structuring' or 'smurfing'.

Common Pitfalls & Interview Traps

Forgetting required sorting and deterministic tie-breaking.
Not accounting for NULL or zero-value denominators during calculations.
Using inefficient quadratic subqueries instead of single-pass business analytics constructs.

Canonical Modern SQL Solution

PostgreSQL 16 / ANSI SQL
SELECT 
        account_id,
        COUNT(*) AS suspicious_deposits_count,
        SUM(deposit_amount) AS total_structured_amount
      FROM cash_deposits
      WHERE deposit_amount BETWEEN 9000.00 AND 9999.99
      GROUP BY account_id
      HAVING COUNT(*) >= 2
      ORDER BY total_structured_amount DESC;
Approach Breakdown
This query addresses the problem requirements by filtering and structuring data in Business Analytics. It meets the target criteria: Suspected smurfing bank accounts with 2 or more sub-$10k deposits.

Edge Cases to Verbally Clarify with Your Interviewer

The dataset contains zero matching records (must return valid empty result without crashing).
Multiple records tie on sorting criteria (must evaluate tie-breaking order deterministically).
Foreign keys or secondary attributes have NULL values.

Frequently Asked Follow-Up Questions

What makes this question a favorite among Stripe and Coinbase interviewers?

Interviewers use this problem to test whether candidates write defensive, scalable Business Analytics queries that run efficiently on multi-million row production databases without excessive memory usage.

How does the query optimizer execute this query?

Using single-pass table scans with index lookups or sort buffers. Running EXPLAIN (ANALYZE, BUFFERS) in the DB Exercises workbench visualizes the execution nodes and buffer hit cache.

More FAANG SQL Interview Questions

View all questions