Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Reconcile ERP and Planning Balances

MediumSQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is Reconcile ERP and Planning Balances. Start with the requirements and the one table on the right.

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.

Problem

You are given a single reconciliation table that contains balance snapshots from two sources: ERP and a planning tool. Write a PostgreSQL query that returns each account with its ERP balance, planning balance, and the variance between them, then sort the accounts by the largest absolute variance. Treat missing source values as zero when calculating variance.

Schema

reconciliation_balances
ColumnTypeDescription
account_idINTAccount identifier
account_nameVARCHAR(100)Account name
source_systemVARCHAR(20)Source system name, such as ERP or Planning
as_of_dateDATESnapshot date
balance_amountDECIMAL(12,2)Reported balance amount
Tablesreconciliation_balances
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results