Tool Logo

SQL Validator

Check whether a query is valid MySQL or PostgreSQL before you run it.

0 characters

Loading tool…

How to use the sql validator

The validator parses your SQL with node-sql-parser, a full SQL parser with separate grammars for MySQL/MariaDB and PostgreSQL. If the query is valid you see how many statements it contains and their types; if not, you get the first syntax error with its line and column, for example SELEC * FORM users is caught at once.

  1. Paste your SQL or upload a .sql file.
  2. Choose MySQL / MariaDB or PostgreSQL.
  3. Read the result: valid, or the syntax error with its line and column.

When to use it

  • Before running

    Catch typos in a query before it reaches the database.

  • Migrations

    Check hand-written migration scripts for syntax errors.

  • Learning SQL

    See exactly where a query stops being valid.

Frequently asked questions

Which databases are supported?

MySQL (also used for MariaDB) and PostgreSQL. Choose the one your query is written for, because their syntax differs.

Does it check that my tables and columns exist?

No. It checks syntax only, because it has no access to your database. A query can be valid SQL and still fail if a table doesn't exist.

Can I check several statements at once?

Yes. Separate them with semicolons; the result lists each statement's type.

What does the error message mean?

It shows what the parser expected at that position and what it found instead, with the line and column, which usually points straight at the typo.

Is my SQL uploaded?

No. Everything runs in your browser; nothing you paste or upload is sent to our servers.