Flag cards that were used in at least 3 DIFFERENT countries within 60 minutes. A window starts at any transaction of the card and includes transactions up to and including exactly 60 minutes later. Rows with NULL country are ignored. For each flagged card return `card_id`, `window_start` (the EARLIEST transaction time that starts a qualifying window) and `countries` (distinct countries inside that window). Order by `card_id`.
| Column | Type |
|---|---|
| txn_id | INTEGER |
| card_id | TEXT |
| txn_ts | TIMESTAMP |
| country | TEXT |
| txn_id | card_id | txn_ts | country |
|---|---|---|---|
| 1 | C1 | 2026-10-10 10:00:00 | IN |
| 2 | C1 | 2026-10-10 10:20:00 | AE |
| 3 | C1 | 2026-10-10 10:50:00 | SG |
| 4 | C2 | 2026-10-10 09:00:00 | US |
| 5 | C2 | 2026-10-10 09:30:00 | US |
| 6 | C2 | 2026-10-10 09:45:00 | CA |
| 7 | C3 | 2026-10-10 08:00:00 | GB |
| 8 | C3 | 2026-10-10 09:30:00 | FR |
| card_id | window_start | countries |
|---|---|---|
| C1 | 2026-10-10 10:00:00 | 3 |
| C3 | 2026-10-10 09:30:00 | 3 |
Solve it in the live editor on this page — run on sample data, then submit against hidden tests.
‹ First Time a Wallet Goes Negative · Reward Points with Expiry Resets ›
{{ 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.