Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Reconcile Conflicting Invoice Totals

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

Your question is Reconcile Conflicting Invoice Totals. 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

Write a PostgreSQL query to reconcile invoice totals between Literati billing and ERP data for January 2024. Return one row per billing invoice, use the latest ERP snapshot per invoice_number, classify each invoice as match, amount_mismatch, or missing_in_erp, and show the absolute difference when both amounts exist.

Schema

ColumnTypeDescription
invoice_id
invoice_number
member_id
invoice_date
billed_amount
ColumnTypeDescription
snapshot_id
invoice_number
snapshot_date
erp_amount
Tablesbilling_invoiceserp_invoice_snapshots
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results