AML monitoring: a near-threshold deposit has 9000 <= amount < 10000. A 7-day window starts on the date of a near-threshold deposit d and covers d to d + 6 days inclusive. Flag an account when some window contains at least 3 near-threshold deposits. For each flagged account report its EARLIEST qualifying window: account_id, window_start, deposits_in_window (near-threshold deposits in that window) and total_in_window (their sum, ROUND 2). Order by account_id.
| Column | Type |
|---|---|
| deposit_id | INTEGER |
| account_id | TEXT |
| deposit_date | DATE |
| amount | REAL |
| deposit_id | account_id | deposit_date | amount |
|---|---|---|---|
| 1 | AC1 | 2026-02-01 | 9500 |
| 2 | AC1 | 2026-02-03 | 9800 |
| 3 | AC1 | 2026-02-06 | 9100 |
| 4 | AC1 | 2026-02-20 | 9900 |
| 5 | AC2 | 2026-02-01 | 9500 |
| 6 | AC2 | 2026-02-05 | 12000 |
| 7 | AC2 | 2026-02-07 | 9400 |
| 8 | AC3 | 2026-02-10 | 9999 |
| account_id | window_start | deposits_in_window | total_in_window |
|---|---|---|---|
| AC1 | 2026-02-01 | 3 | 28400 |
| AC3 | 2026-02-10 | 3 | 28199 |
Solve it in the live editor on this page — run on sample data, then submit against hidden tests.
‹ Rolling 7-Day Notional With Missing Days · 90th Percentile Spend per Card Tier ›
{{ totalCount }} questions in the style asked at Amazon, Microsoft, Google, Meta, Flipkart and more — {{ hardPct }}% Hard. Write SQL in a real database engine in your browser, run it on sample data, then evaluate against hidden tests.
Company tags show where this type of question is commonly reported in interviews. Questions, data and solutions are written by TechTown.
{{ cur.statement }}
No submissions yet. Press Evaluate to submit your query.
{{ solutionSql }}
{{ out.error }}
You have solved your 3 free questions — nice work! Log in (free) to unlock all 150 questions, keep your streak and appear on the leaderboard.