Database reconciliation query: find missing and mismatched rows

A database reconciliation query finds records that differ between two sources expected to agree. It helps you separate missing records, duplicate keys and mismatched values before correcting anything. The example below compares a fictional equipment loan register with a pickup log so that the causes of discrepancies stay visible.

Define what a database reconciliation query should compare

Choose the unit that should appear in both sources. If each pickup belongs to one loan request, a request identifier may be the right match key. If a request can contain several items collected separately, you may need the request identifier and the item identifier together.

Define which records are eligible for comparison. A request marked ready for pickup is not expected to have a pickup entry yet. Compare completed requests for the same period, using a clear rule for the timestamp that puts an entry in scope. Keep that rule with the query so its results can be repeated.

Check how time and status are recorded. A pickup at the end of a reporting day may not appear in an export taken before the event. One system may record an event date and another may record when the entry was posted. Agree on what comparison is meaningful before treating a missing row as an error.

Decide which fields should agree after a match. The register and log may share a request number, pickup location and quantity. The pickup time might be recorded only in the log. Keep fields that serve different purposes out of the equality test or state the rule that connects them.

Check keys and counts before joining the sources

Count eligible rows and distinct keys in both extracts. If the pickup log contains 115 rows and 113 distinct keys, review the repeated keys. They may be true duplicates or separate pickups that show the proposed key is incomplete. Joining immediately can multiply rows and overstate discrepancies.

Handle blank identifiers separately. Two rows with no request number should not be treated as a match just because both are blank. Put missing keys in an exception list and trace them using approved source evidence. Avoid matching them by a loose guess such as pickup day alone.

Normalize identifiers only when you know the relevant conventions. A leading zero may be part of an identifier rather than display formatting. Keep the original value beside any standardized one, and test the transformation on examples from each system. Confirm that it does not collapse two distinct keys.

If you need to explain why identifiers repeat, inspect the underlying relationship. A one-to-many relationship can be correct when a request covers several items. The guide to database normalization and dependencies explains why the unit represented by each row matters to the design.

Classify records missing on either side and mismatched values

Once the join key is suitable, compare in both directions. List register entries with no corresponding pickup and pickup entries with no corresponding register record. A full outer join can represent both directions in databases that support it; two separate missing-record checks can make the same distinction.

For matched records, compare the selected fields. Check how your query handles a missing value. A blank pickup location on one side and a named location on the other is different from two confirmed locations that disagree. Give the categories separate labels if the team will investigate them differently.

For example, a matched request that says North Store in the register and South Store in the log needs a location check. A pickup record with no matching request may instead come from an older system or contain a mistyped number. The categories suggest different next steps even if both show up on the same report.

Preserve a reason when a comparison cannot be made. If a system stores equipment quantities as packages and another stores items, convert them only with a documented factor. If that factor varies by equipment type and is unavailable, flag the quantity as unverified rather than calling every different number an error.

For a small rehearsal, suppose the register contains request keys 31, 32 and 33, while the pickup log contains 31, 33 and 34. The query should show 32 as missing from the pickup log and 34 as missing from the register. Keys 31 and 33 remain in the matched group even if a selected field differs.

If location for key 33 differs, report that as a mismatch within the matched group. Do not subtract it from the matched count or treat it as another missing key. The classification lets the team verify that each row contributes to the correct count.

Run the same rehearsal with a duplicate key and confirm that it is flagged before the join.

Validate the output before using it to correct records

Trace examples from each result group to the original sources. Include a known match, one missing entry on each side and one mismatch. Compare the reported totals with the eligible key counts. When both sources have one row per key, the count of matched keys plus missing keys on that side should equal its eligible key count.

Check that the output includes enough context to act. A report can show the key, dates, observed values and category without copying the entire source record. Where the two systems disagree, mark which team can confirm the correct value. The query identifies a discrepancy; the correction may still require a human decision.

Keep reconciliation separate from updates. Start with a read-only comparison, then record approved changes through the normal process. Rerun the same comparison afterward and explain any remaining differences, including known timing gaps. This keeps a visible link between the original finding and the result after correction.

Save the query version and reporting window with the output. If a later run finds more missing pickups, another reader should be able to tell whether the underlying data changed or the comparison rules changed. That record makes reconciliation useful as a repeatable check rather than a one-time list of problems.

Ready when you are

Start your order with the essentials

Enter the topic, length, and deadline. We will carry these details into the full order form.

Secure checkout Upload instructions on the order form Support available when you need it