Yesterday's Crown
A hard SQL interview practice problem on DataDriven. Write and execute real sql code with instant grading.
- Domain
- SQL
- Difficulty
- hard
- Seniority
- L4
Problem
A cost dashboard needs each date paired with the previous day's top-spending service, with daily service totals rounded to two decimals before they are compared. Where several services tie for the highest spend, include all of them, and skip any date without a prior day on record. Return the billing day, the service name, and that total amount.
Summary
Every dawn inherits the spending of the day before.
Practice This Problem
Solve this SQL problem with real code execution. DataDriven runs your SQL queries against a real database and grades it automatically.