Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Reconcile ERP Actuals to Plan Variances

MediumSQL · PostgreSQL00:00
I
Practice interviewer
Your interviewer
In session
I
Interviewer

Welcome to the SQL screen.

The question is on your right: Reconcile ERP Actuals to Plan Variances. Read through the requirements and the two tables first.

Run and submit your code as often as you need. You also have five interviewer messages this session - want to talk through your approach, or are you ready to start coding?

You need to log in / sign up to run or submit.

Problem

You are given ERP actuals and a planning tool extract for the same fiscal months. Write a PostgreSQL query that reconciles the two sources by account_code and fiscal_month, returns the actual amount, planned amount, and variance, and flags each row as matched, actual_only, plan_only, or mismatch when the numbers do not tie.

Schema

erp_actuals
ColumnTypeDescription
actual_idPKINTPrimary key for the ERP posting
account_codeVARCHAR(20)General ledger account code
fiscal_monthDATEMonth bucket for the actuals
actual_amountDECIMAL(12,2)Posted ERP amount
source_systemVARCHAR(50)ERP source name
plan_forecast
ColumnTypeDescription
plan_idPKINTPrimary key for the plan row
account_codeVARCHAR(20)Planning account code
fiscal_monthDATEMonth bucket for the plan
planned_amountDECIMAL(12,2)Planned amount from the planning tool
version_nameVARCHAR(50)Plan version
Tableserp_actualsplan_forecast
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results