SoloMedium6m
Find the Duplicate Customer Charges
Finance escalation — CFO meeting in 4 hours
Marcus (Head of Finance): 14 customers say we charged them twice. Quantify it from prod.transactions: customers affected, total overcharged, when it started.
Diana (Analytics Lead): Same customer_id, same amount, within 5 minutes. Use window functions (LAG, ROW_NUMBER, PARTITION BY) — the table is 2M rows; do not use pandas.
Your task
Complete duplicate_charges.sql in your workspace repo. CI validates your result set against the expected duplicate pairs ($349.97 overcharged, 2 customers, triple-charge on customer 103).
Skills: SQL window functions, CTE structure, timestamp math, defensive filtering (status = completed, < 300 seconds).
Skills you'll prove
sqlwindow-functionsdata-analyticspostgresqlfinancebook-vs-prod