SQL Formatter
Formats SQL queries for MySQL, PostgreSQL, SQLite, SQL Server, and more.
An SQL syntax checker for MySQL, MariaDB, PostgreSQL, SQLite, SQL Server, and BigQuery. It points to the line and column of the first error and says what the parser expected there.
Press Validate. The parser for the chosen dialect downloads once, then every check runs instantly.
Only this once. Your SQL stays in the browser.
.sql file up to 1 MB.The check uses node-sql-parser, an open-source parser with a separate grammar for each dialect. Each grammar is about 230 to 330 KB, so only the one you pick is downloaded, and it runs in your browser.
The parser reads the statements from the start and stops at the first token that its grammar does not allow. Its list of what it would have accepted can be long and technical. The tool shortens it: comment markers and whitespace are dropped, character classes become "a name" or "a number", and keywords are shown in capitals.
A valid result lists how many statements of each type were found, such as SELECT 2, UPDATE 1.
SELECT a,, b FROM t fails with Unexpected "," at line 1, column 10. The parser expected a column name or an expression after the first comma.SELECT * FROM fails with The query ends before it is complete, because a table name has to follow FROM.SELECT 'abc FROM t reports A quoted string is never closed.INSERT INTO t (a) VALUES (1) RETURNING a passes as PostgreSQL. As MySQL it fails, since MySQL has no RETURNING clause.No. It checks that the SQL is well formed. Wrong results come from the logic of the query or the data, which only running it can show.
No. The parser runs in your browser, so table names and literal values in the query stay on your device.
The dialect may be set wrong, or your database accepts an extension the grammar does not know. Try the exact dialect, and treat the result as a hint rather than the final word.
Often used together with SQL Validator.
Formats SQL queries for MySQL, PostgreSQL, SQLite, SQL Server, and more.
Removes comments and extra whitespace from SQL, keeping strings and optimizer hints intact.
Generates CREATE, INSERT, SELECT, UPDATE, and DELETE statements for four databases.