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 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.
| Column | Type | Description |
|---|---|---|
| entry_idPK | INT | Primary key for the ledger row |
| account_code | VARCHAR(20) | General ledger account code |
| entry_month | DATE | First day of the accounting month |
| ledger_amount | NUMERIC(12,2) | Posted amount in the ledger |
| Column | Type | Description |
|---|---|---|
| report_idPK | INT | Primary key for the report row |
| account_code | VARCHAR(20) | General ledger account code |
| report_month | DATE | First day of the reporting month |
| reported_amount | NUMERIC(12,2) | Amount shown in the financial report |