MediumJoins
Cross-Border Wire Transfers with Beneficiary KYC Level
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.
Problem Statement
Join `cross_border_transfers` with `bank_accounts` on `beneficiary_acc_id = account_id`.
Return:
1. `t.transfer_id`
2. `t.amount_usd`
3. `a.account_number`
4. `a.account_holder`
5. `a.kyc_status`
Filter for:
- `t.amount_usd >= 15000.00`
- `a.kyc_status != 'Tier_3_Enhanced'`
Order results by `t.amount_usd` descending.
Why Technical Interviewers Ask This
Compliance auditors must verify that international wire transfers exceeding $15,000 USD only flow to accounts with Verified KYC status ('Tier_3_Enhanced'). Unverified accounts receiving large transfers represent severe compliance violations.
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 joins constructs.
Canonical Modern SQL Solution
PostgreSQL 16 / ANSI SQLSELECT
t.transfer_id,
t.amount_usd,
a.account_number,
a.account_holder,
a.kyc_status
FROM cross_border_transfers t
JOIN bank_accounts a ON t.beneficiary_acc_id = a.account_id
WHERE t.amount_usd >= 15000.00
AND a.kyc_status != 'Tier_3_Enhanced'
ORDER BY t.amount_usd DESC;Approach Breakdown
This query addresses the problem requirements by filtering and structuring data in Joins. It meets the target criteria: Compliance violation list of high-value wires sent to unverified accounts.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 Joins 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.