DataDrivenDataDriven
LearnPracticeInterviewDailyJobsCommunity

Two Sides of the Ledger

A hard SQL mock interview question on DataDriven. Practice with AI-powered feedback, real code execution, and a hire/no-hire decision.

Domain
SQL
Difficulty
hard
Seniority
L5

Interview Prompt

Given two tables: cloud_costs (actual cloud charges, positive amounts that represent expenses, dated by day as YYYY-MM-DD) and cost_allocs (budget allocations, positive amounts that represent inflows, recorded by month as YYYY-MM), write a query that reports a running financial balance per region on a monthly timeline. Negate the charges so they draw the balance down and keep allocations positive, truncate each charge's billing date to its month, combine both sources into one stream, net the movements per region and month, and show each region and month with the balance standing after it, ordered by region then month.

Summary

Two cost tables, one region. Which way does the balance tip?

How This Interview Works

  1. Read the vague prompt (just like a real interview)
  2. Ask clarifying questions to the AI interviewer
  3. Write your sql solution with real code execution
  4. Get instant feedback and a hire/no-hire decision

Related

  • All Mock Interviews
  • Practice Mode (untimed)
  • SQL Interview Questions
  • Data Engineering Interview Prep Guide
  • Practice Problems
  • Daily Challenge