SQL Quest › SQL Interview Questions › Joins
Cross-Account Collusion — Shared Device Fingerprint
Synthetic-identity fraud signature: multiple accounts created on the same device share a device_fingerprint. Find every PAIR of accounts that share a fingerprint — production fraud teams add IP blocks, browser fingerprints, and behavioral patterns on top, but device alone catches the obvious cases.
Use a self-join with a1.account_id < a2.account_id to avoid double-counting and self-pairs. Show account_a, account_b, device_fingerprint, a_signup, b_signup, hours_apart (rounded to 1 decimal — accounts created within hours of each other are the most suspicious).
Order by hours_apart ascending (closest signups first).
Solve it in the browser editor →
Runs on SQLite in your browser, graded against the expected result, no signup. A wrong answer gets a diagnosis, not just "incorrect".
Schema
accounts
| account_id | signup_at | country | device_fingerprint | ip_block | status | |
|---|---|---|---|---|---|---|
| 1 | user1@example.com | 2026-02-24T00:00:00.000Z | TR | dev_13c0cdad | 41.116.196.153 | active |
| 2 | user2@inbox.dev | 2025-05-13T00:00:00.000Z | JP | dev_26576d49 | 38.98.201.102 | active |
| 3 | user3@inbox.dev | 2026-04-25T00:00:00.000Z | JP | dev_42f1a115 | 190.77.45.244 | flagged |
Expected output: Account pairs sharing a device
Hint
Concepts
SELECT Self-JOIN WHERE Self-Join
Practise the topic: SQL practice questions · JOIN practice
Related questions
Where would this cost you points in an interview?
Ten questions, no signup: a Skillmap across nine SQL skills and the one to fix first.
Take the readiness test