GALAXY OF TOOLS

DEV SECTOR

SQL Validator

Check SQL syntax for MySQL, PostgreSQL, SQL Server, SQLite and more, with line, column and fix hints.

The parser for the chosen dialect loads the first time you check (about 70 KB).

This checks syntax only. It does not connect to a database, so it cannot tell you whether tables or columns exist, whether types match or whether you have permission. Oracle PL/SQL is not available because the parser has no Oracle grammar.

Runs entirely in your browser. Nothing you enter or upload is sent to a server.

Check SQL syntax before you run it

The SQL Validator is a syntax checker for SQL queries and scripts. Paste one statement or a whole migration file, choose your database, and every statement gets its own verdict: valid, or a syntax error with the exact line and column, the tokens the parser expected at that point and a plain-English hint about the likely cause.

It supports MySQL, MariaDB, PostgreSQL, SQL Server (T-SQL), SQLite, Google BigQuery, Amazon Redshift, IBM Db2 and Trino/Presto, using the dialect grammars of the open-source node-sql-parser library (Apache-2.0). Oracle is not offered: the library has no Oracle grammar, and guessing would give you false errors.

Everything runs in your browser. Your queries, and any table names or data inside them, are never uploaded — useful when the SQL comes from a production system or a client project.

How to use the SQL Validator

  1. Choose your database in SQL dialect. Quoting rules differ, so the same query can be valid in one dialect and invalid in another.
  2. Paste SQL into SQL to check, drop a .sql file on it, or press Load file. Separate statements with semicolons; GO lines (SQL Server) and DELIMITER lines (MySQL) are understood.
  3. Press Check SQL. After the first check, results refresh as you type.
  4. Read each error: the position, what the parser expected, and the hints underneath. Press Show in editor to jump to the exact spot.
  5. Review the Parsed structure table to confirm each statement’s type, tables and columns, and open Syntax tree (JSON) if you need the full parse.

SQL Validator features

Per-statement verdicts

A script is split on semicolons (outside strings, comments and procedure bodies), and each statement is parsed on its own, so one mistake does not hide the rest.

Exact error positions

Errors show the line and column in your whole script, a caret under the offending token and the list of tokens that would have been valid there.

Common-mistake hints

Missing or trailing commas, keywords such as order or user used as names, incomplete conditions, unclosed quotes and brackets, missing semicolons and TOP versus LIMIT.

Warnings for valid SQL

Flags an UPDATE or DELETE without WHERE, comparisons with = NULL, and double-quoted “strings” that PostgreSQL or SQL Server will read as column names.

Parsed structure

See the statement type and which tables and columns each statement reads or writes, plus the complete syntax tree as JSON.

Worked example

Check this MySQL script, which contains a classic copy-and-paste slip:

SELECT id, name, email,
FROM customers
WHERE deleted_at = NULL;

The validator reports Syntax error · line 2, column 6: the parser accepted FROM as a fourth column name, then found customers where it expected a comma, FROM or the end of the statement. The hint pinpoints the real cause — a trailing comma at line 1, column 23 before FROM. Remove the comma and the statement becomes valid, but a warning remains: = NULL is never true, so the query would return no rows. Changing it to IS NULL clears the warning.

What each dialect covers

Each dialect has its own grammar. In our tests, SELECT (with joins, subqueries, CASE, window functions and CTEs), INSERT, UPDATE, DELETE, CREATE TABLE, ALTER TABLE and DROP TABLE parse in MySQL, MariaDB, PostgreSQL, SQL Server, SQLite, Redshift and Trino. Known gaps:

  • BigQuery expects its own types in DDL (INT64, STRING); INT and VARCHAR in CREATE TABLE are rejected, and CREATE INDEX is not supported.
  • Db2 uses FETCH FIRST n ROWS ONLY; LIMIT and CREATE INDEX are not in its grammar.
  • SQL Server: the grammar is lenient about LIMIT, which SQL Server itself rejects, so the validator adds a warning when it sees it.
  • Stored procedures, functions and triggers (CREATE PROCEDURE … BEGIN … END) are mostly outside every grammar. They are marked “Not checked” rather than reported as errors.

Syntax check, not a database

A syntax checker answers one question: is this text a well-formed statement in that dialect? It cannot know your schema, so a query that selects a column that does not exist, joins on mismatched types or violates a constraint will still pass here and fail on the server. Run it against a development database for that. The parser is also an approximation of each vendor’s grammar — rarely used or very new syntax may be rejected even though your database accepts it.

Once the syntax is right, tidy the layout with the SQL Formatter. If your query returns JSON or CSV, the JSON Formatter and CSV to JSON converter help you inspect the results.

SQL Validator FAQ

Is this SQL validator free and private?

Yes. It is free with no sign-up or limits, and the parser runs in your browser. Your SQL is never sent to a server, so you can check queries that contain real table names or data.

Which databases can I validate SQL for?

MySQL, MariaDB, PostgreSQL, SQL Server (T-SQL), SQLite, Google BigQuery, Amazon Redshift, IBM Db2 and Trino/Presto. Oracle PL/SQL is not available because the underlying parser has no Oracle grammar.

Why does valid SQL show an error?

Usually the wrong dialect is selected — backticks, square brackets and double quotes mean different things in different databases. Less often the statement uses syntax the parser does not know yet; the “What each dialect covers” section lists the known gaps.

Does it check that my tables and columns exist?

No. It checks syntax only, without connecting to a database. A misspelt column name is still valid syntax, so it will pass here and fail when you run it.

Why is the error reported after the real mistake?

A parser reports the first point where the text can no longer be valid. With a trailing comma before FROM, for example, FROM is first read as a column name, so the error appears one token later. The hints look around the error for causes like this and point to the real spot.

Can I check a whole .sql file with many statements?

Yes. Load or paste the file and each statement is checked separately, with its own verdict. Files up to 5 MB load; results update live while the script is under about 400,000 characters.

You might also need