SQL

SQL fixer and explainer

When a query will not run, or you inherited one you cannot read, DocuFormat can point at structural problems locally and use AI, when you ask, to repair or explain it.

broken.sqlDetected: SQL ✓
SELECT id, nameFROM usersWHERE (status = 'active' AND role = 'admin'ORDER BY name
✗ line 3: Unclosed "("
suggested.sqlAI suggestion
SELECT id, nameFROM usersWHERE (status = 'active' AND role = 'admin')ORDER BY name;
✓ Illustrative output · review before use

What the local checks find

  • unclosed or unmatched parentheses
  • unterminated string literals and quoted identifiers
  • unterminated block comments
  • text that does not start with a recognizable SQL statement
  • statements that stop right after WHERE, JOIN, AND and similar

These run instantly in your browser. They cover common structural slips, not every dialect-specific syntax rule.

Where AI helps

For anything subtler, choose AI Fix. Your selected dialect is sent along, so a suggestion can follow PostgreSQL or SQL Server conventions. You get a corrected query, an explanation and a list of changes, and nothing is applied until you accept it.

Explain a query you did not write

Explain describes what a query does in plain language, step by step: which tables are joined, how rows are filtered and grouped, and what the result looks like. The query is analysed as text and never executed.

Safe by construction

DocuFormat has no database connection. Whether you format, check, fix or explain, your SQL is never run. Start with the SQL formatter if the query is valid but hard to read.

Questions, answered

Will AI Fix run my SQL to test it?

No. DocuFormat never executes SQL, and the AI is instructed not to claim to run anything.

Does AI Fix know my schema?

No. It only sees the text you submit, so suggestions are based on syntax and apparent intent.

Is AI required to check my SQL?

No. The structural checks are local and deterministic. AI is used only when you click AI Fix or Explain.

Try the SQL formatter on your own input.

Paste it, format it, and fix it if it is broken, once DocuFormat opens.