Rolling Weekly Total
A medium SQL interview practice problem on DataDriven. Write and execute real sql code with instant grading.
- Domain
- SQL
- Difficulty
- medium
- Seniority
- L5
Problem
A fraud detection model monitors spending velocity. Return every transaction along with a rolling 7-day spending total for the same user, ordered by transaction date. Include user_id, transaction_date, total_amount, and the rolling sum.
Summary
Seven days at a time, the totals keep rolling forward.
Practice This Problem
Solve this SQL problem with real code execution. DataDriven runs your SQL queries against a real database and grades it automatically.