How do you ensure accuracy when managing large, complex data sets in Excel?
Write a PostgreSQL query that audits imported records against reference records and returns every discrepancy, including records present in only one source. Treat two NULL values as matching.
record_key, imported and expected amounts, imported and expected statuses, and discrepancy_type.record_key ascending.record_key, imported_amount, expected_amount, imported_status, expected_status, discrepancy_type.missing_import or missing_reference, respectively.amount_mismatch, status_mismatch, or amount_and_status_mismatch.NULL and one non-NULL amount or status as mismatching.| Column | Type | Description |
|---|---|---|
| import_idPK | INT | Unique identifier for the imported row |
| record_key | VARCHAR(20) | Business key identifying the record |
| imported_amount | DECIMAL(12,2) | Amount loaded from the imported data |
| imported_status | VARCHAR(20) | Status loaded from the imported data |
| Column | Type | Description |
|---|---|---|
| reference_idPK | INT | Unique identifier for the reference row |
| record_key | VARCHAR(20) | Business key identifying the record |
| expected_amount | DECIMAL(12,2) | Authoritative amount for comparison |
| expected_status | VARCHAR(20) | Authoritative status for comparison |