Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Reconcile Financial Report Discrepancies

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

Your question is Reconcile Financial Report Discrepancies. Start with the requirements and the two tables 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 monthly financial report data from two sources: the official ledger and the reporting export. Write a PostgreSQL query that identifies ledger entries that do not reconcile with the report for the same account and month, and shows the variance amount for each mismatch.

Return only rows where the ledger amount and report amount differ or where no matching report row exists. Treat missing report amounts as 0 when calculating variance.

Schema

ledger_entries
ColumnTypeDescription
entry_idPKINTPrimary key for the ledger row
account_codeVARCHAR(20)General ledger account code
entry_monthDATEFirst day of the accounting month
ledger_amountNUMERIC(12,2)Posted amount in the ledger
report_exports
ColumnTypeDescription
report_idPKINTPrimary key for the report row
account_codeVARCHAR(20)General ledger account code
report_monthDATEFirst day of the reporting month
reported_amountNUMERIC(12,2)Amount shown in the financial report
Tablesledger_entriesreport_exports
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results