The Weight of Everything Before
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
- mid
Interview Prompt
The lifecycle analytics team is studying how each customer's spend accumulates over their lifetime on the platform, because lifetime-value models depend on seeing the full trajectory of a buyer rather than a single snapshot. For every purchase a customer has ever made, they want to see that buyer's cumulative spend as it stood at the moment of that purchase, with each customer's history walked forward from their earliest transaction to their most recent. Produce one row per purchase showing the customer, the date of that purchase, and the total amount the customer had spent up to and including that point, laid out customer by customer and earliest to latest within each.
Summary
Every purchase carries the ones that came before it. Trace the climb.
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