DataDriven
LearnPracticeInterviewDiscussDailyJobs

The Weight of Everything Before

A medium SQL interview practice problem on DataDriven. Write and execute real sql code with instant grading.

Domain
SQL
Difficulty
medium
Seniority
mid

Problem

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.

Practice This Problem

Solve this SQL problem with real code execution. DataDriven runs your SQL queries against a real database and grades it automatically.

Related

  • All Practice Problems
  • Mock Interview Mode
  • SQL Interview Questions
  • Data Engineering Interview Prep Guide
  • Daily Challenge
  • Data Engineering Lessons