The Subscription Ghost
A medium SQL mock interview question on DataDriven. Practice with AI-powered feedback, real code execution, and a hire/no-hire decision.
- Domain
- SQL
- Difficulty
- medium
- Seniority
- L5
Interview Prompt
A billing-integrity team is hunting for accidental recurring charges: a customer gets billed the exact same amount for the exact same product roughly a month apart, often a sign of a duplicate subscription or a botched retry. In the transactions table, for each user_id and product_id combination ordered by transaction_date, compare every transaction to the one immediately before it within that same combination. If the total_amount is identical to the previous transaction's amount AND the two transactions occurred 35 days or fewer apart, flag it as a ghost charge. Return the total count of such ghost charges as repeated_count.
Summary
Some charges come back to haunt the same card a month later.
How This Interview Works
- Read the vague prompt (just like a real interview)
- Ask clarifying questions to the AI interviewer
- Write your sql solution with real code execution
- Get instant feedback and a hire/no-hire decision