Two Sides of the Ledger
A hard SQL interview practice problem on DataDriven. Write and execute real sql code with instant feedback.
- Domain
- SQL
- Difficulty
- hard
- Seniority
- L5
Problem
The FinOps team reconciles each region's cloud charges against its budget allocations on a single monthly timeline, where a charge draws the region's balance down and an allocation builds it back up. Charges are stamped with a full billing date while allocations are recorded by month, so line each charge up on its month before combining the two sources. For every region and month, show the net movement and the balance standing after it, earliest month first within each region.
Summary
Two cost tables, one region. Which way does the balance tip?
Practice This Problem
Solve this SQL problem with real code execution. DataDriven runs your SQL queries against a real database and checks it automatically.