AnalystPath

Detect Duplicate Payments

SQLHardSenior levelStripe~15 min

Problem

**[Asked at Stripe]**

A duplicate payment is when the **same customer** uses the **same credit card**
to pay the **same amount** to the **same merchant**, with the transactions
occurring **within 10 minutes of each other**.

Count the total number of duplicate payment events (do not count the original —
only the duplicates).

Tables

Example rows — the live problem includes the full dataset.

transactions
txn_idmerchant_idcard_idamounttxn_time

Expected output

Your answer should return 1 row with the columns duplicate_count.

Starter code (SQL)

SELECT *
FROM transactions;

Solve this SQL question free

Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related SQL questions