# Find rows that break the schema

> List the rows that break their table's rules now, with check_table, for one table or the whole database.

`check_table` checks the rows a table holds now against its columns and CHECK constraints, and lists the ones that break a rule. Use it after hand edits, after a sync, or before you tighten a rule. Without `table`, it checks every table, page by page. It writes nothing.

## Find rows that break the schema

The engine can’t refuse a hand edit, so a note you edit by hand can break the schema. `check_table` validates every row against these rules:

* **Values**: types, ranges and enums
* **Presence**: required columns and unknown keys
* **Relations and rules**: links and constraints

You edit `datanotes/main/public/film/His Girl Friday.md` by hand, outside the engine. The note now reads:

```markdown
---
table: main.public.film
id: 01a0f000-0000-7000-8000-0000000000bb
title: His Girl Friday
year: 1940
status: finished
rating: 6
format: Blu-ray
---
```

**`check_table`**

```json
{ "table": "film" }
```

Answer:

```json
{
  "table": "film",
  "rows_checked": 3,
  "total": 1,
  "violations": [
    {
      "path": "datanotes/main/public/film/His Girl Friday.md",
      "violations": [
        {
          "column": "status",
          "code": "enum",
          "message": "must be one of: to watch; watched",
          "value": "finished"
        },
        { "column": "rating", "code": "max", "message": "must be <= 5", "value": 6 },
        {
          "column": "format",
          "code": "unknown_column",
          "message": "is not a column of table \"film\"",
          "value": "Blu-ray"
        }
      ]
    }
  ]
}
```
