Canonical: https://botbento.com/usecases/reconcile-linked-business-tables-and-flag-broken/
Format: Markdown representation of the public HTML page.

# Reconcile linked business tables and flag broken records

[Operations](https://botbento.com/usecases/ops/) · Intermediate

Cross-check related tables for missing keys and mismatched totals

A bot walks a relational dataset spanning sales, billing, warehouse and support. It checks that every foreign key resolves, that ledger totals agree with invoice lines, and that records for the same buyer share one identity. It lists each break with the tables and rows involved so someone can decide on a fix.

## Quick answers

**What does it do?** Cross-check related tables for missing keys and mismatched totals. Result: Reconciliation report with breaks.

**What does it need?** Tools: PostgreSQL, Slack, Database, Spreadsheet. Intermediate: some setup.

**How do I run it?** On a schedule: Weekly data sweep. Copy the prompt below into a bot in BotBento.

## How it works

1. On a schedule: Weekly data sweep
2. Then: Check keys and totals across tables
3. Result: Reconciliation report with breaks

## Prompt to start with

```text
Run scheduled consistency sweeps over the connected database. Start from the tables named in the run config, verify that each foreign key resolves, compare ledger and invoice totals, and flag duplicate customer identities that share an address or contact detail. Record every finding with table name, row count and a short description, then post the run summary to the ops channel. Never delete or overwrite rows, and hold any outbound message or payment adjustment until the user approves it.
```

## Tools it uses

Database, PostgreSQL, Spreadsheet, Slack

## Works with

BotBento

## Tags

data-quality, reconciliation, sql, reporting, ops

## Source

[Pepperwind, a fictional company dataset with 223 tables and 79M rows](https://news.ycombinator.com/item?id=50333045) — Hacker News · checked 2026-11-13

Summarized in our own words. Any results described there are the authors’ own, not measured by BotBento.

By BotBento Editorial · Added 2026-11-13 · Updated 2026-11-13 · [Suggest a correction](https://botbento.com/contact/)

## Related use cases

- [Detect metric drift and funnel anomalies](https://botbento.com/usecases/automated-business-metric-and-funnel-drift-detective/) — Query business data, spot irregular trends, and draft executive briefings for review
- [Flag at-risk deals from open support tickets](https://botbento.com/usecases/cross-system-audit-for-closing-deals-with/) — Cross-check closing pipeline deals against open tickets and bugs to surface revenue risks early
- [Check sales transcript budget figures for arithmetic conflicts](https://botbento.com/usecases/check-sales-transcript-budget-figures-for-arithmetic/) — Extract numeric claims and flag mismatches before handoff
