Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Budget vs Actual Variance Report
00:00
5 left

Budget vs Actual Variance Report

MediumSQL · PostgreSQL

Problem

FinSight tracks department spending in a single budgeting table. Write a SQL query to report departments where actual spending differs from projected budget.

Requirements

  1. Return each department with its total projected budget, total actual spend, and the variance (actual_spend - projected_budget).
  2. Include only departments where the totals do not match.
  3. Add a status column that shows Over Budget when actual spend is greater than projected budget, otherwise Under Budget.
  4. Order the results by absolute variance descending, then by department name.

Schema

department_budget_actuals
ColumnTypeDescription
idPKINTPrimary key for each budget record
departmentVARCHAR(100)Department name
projected_budgetDECIMAL(12,2)Projected budget amount for the record
actual_spendDECIMAL(12,2)Actual expenditure amount for the record
report_monthDATEReporting month for the budget entry
cost_centerVARCHAR(50)Cost center associated with the record
Tablesdepartment_budget_actuals
Interviewer

Your question is Budget vs Actual Variance Report. Start with the requirements and the one table in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
Sign up free to run your codeLog inLn 1
Run your query to see results here.