Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Reconcile Conflicting Invoice Totals
00:00
5 left

Reconcile Conflicting Invoice Totals

MediumSQL · PostgreSQL

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
Interviewer

Your question is Reconcile Conflicting Invoice Totals. Start with the requirements and the two tables in the Question tab.

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.
CodePostgreSQL
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.