Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Validate Bank Reconciliation Completeness

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

Your question is Validate Bank Reconciliation Completeness. Start with the requirements and the three 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 a bank reconciliation dataset with ledger entries, bank statement transactions, and reconciliation runs. Write a PostgreSQL query that validates whether each reconciliation run is complete and accurate by comparing ledger and bank transactions for the same account and statement period.

Return one row per reconciliation run with the total ledger amount, total bank amount, the variance between them, the count of unmatched ledger items, the count of unmatched bank items, and a status of complete only when both sides balance and there are no unmatched items.

Schema

reconciliation_runs
ColumnTypeDescription
reconciliation_run_idPKINTPrimary key for the reconciliation run
account_idINTAccount being reconciled
statement_start_dateDATEStart of the statement period
statement_end_dateDATEEnd of the statement period
run_dateDATEDate the reconciliation was performed
ledger_entries
ColumnTypeDescription
ledger_entry_idPKINTPrimary key for the ledger entry
account_idINTAccount associated with the entry
entry_dateDATELedger posting date
amountNUMERIC(12,2)Signed ledger amount
bank_referenceVARCHAR(50)Bank reference if matched; may be NULL
bank_transactions
ColumnTypeDescription
bank_transaction_idPKINTPrimary key for the bank transaction
account_idINTAccount associated with the transaction
transaction_dateDATEBank transaction date
amountNUMERIC(12,2)Signed bank amount
bank_referenceVARCHAR(50)Bank reference if matched; may be NULL
Tablesreconciliation_runsledger_entriesbank_transactions
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results