1. Home
  2. Developer
  3. SQL Syntax Checker

SQL Syntax Checker

Catch common SQL syntax mistakes and tidy the query.

For every format and option in one place, use Code Formatter and Checker →

Runs in your browser · No upload
Statements
3
Errors
2
Warnings
3
SQL input
TypeLocationMessageCode
Error1:48Nothing follows this comma. Remove the comma after the last item.SELECT u.id, u.name, COUNT(o.id) AS order_count,
Warning3:6This JOIN has no ON or USING condition. It becomes a cross product or raises an error.LEFT JOIN orders o
Warning4:16NULL cannot be compared with =. Use IS NULL or IS NOT NULL. The result is always UNKNOWN.WHERE u.status = NULL
Warning8:1UPDATE has no WHERE, so every row is changed. Add a condition unless that is intended.UPDATE users SET status = 'inactive';
Error10:443 columns are listed but 2 values are given.INSERT INTO users (id, name, email) VALUES (1, 'Kim');

Loading the formatter...

This is a rule-based check of quotes, parentheses and clause structure, not a full SQL parser. It does not verify that tables, columns or functions exist. Syntax differs between dialects, so dialect warnings are advisory.

Your SQL is checked in this browser only. It is never uploaded and no database is contacted.

How to use

  1. Paste the query into the SQL input box. It starts with a sample that contains several mistakes.
  2. Pick the SQL dialect that matches your database. Your choice is remembered in this browser.
  3. Read the errors and warnings in the table with their line, column and the code on that line.
  4. Fix the errors and the result refreshes. A formatted copy with uppercase keywords appears below for you to copy.

You can paste several statements separated by semicolons. No database is contacted, so it cannot check that tables or columns actually exist.

What is checked

Group Checks Severity
Quotes and comments Unclosed strings ('), identifiers (", `, [ ]), comments (/* */) and PostgreSQL $$ strings Error
Parentheses Unbalanced ( and ) Error
Commas A comma left before FROM or ), doubled commas Error
Empty clauses No columns after SELECT, nothing after WHERE, FROM, ORDER BY or LIMIT Error
Clause order FROM, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT out of order, BY missing after ORDER Error
INSERT Listed column count differs from the VALUES count (every row is checked) Error
UPDATE No SET clause Error
Risky habits UPDATE or DELETE without WHERE, = NULL comparison, JOIN without ON, SELECTs joined without a semicolon Warning
Typos A statement starting with an unknown word like SELCT suggests the closest keyword Warning
Dialect Syntax that the chosen dialect does not accept Warning

Sample result

Checking the sample in the box as MySQL gives 2 errors and 3 warnings:

  • Line 1, column 48: nothing follows the comma after order_count (error)
  • Line 3: LEFT JOIN orders o has no ON condition (warning)
  • Line 4: u.status = NULL should use IS NULL (warning)
  • Line 8: UPDATE users SET status = 'inactive' has no WHERE, so every row changes (warning)
  • Line 10: 3 columns are listed but 2 values are given (error)

Dialect differences

The same intent is written differently by each database. The items below are flagged when they do not fit the selected dialect.

Goal MySQL, MariaDB PostgreSQL SQL Server Oracle
First N rows LIMIT n LIMIT n TOP n FETCH FIRST n ROWS ONLY
Quote identifiers Backticks Double quotes Double quotes or [ ] Double quotes
Case-insensitive match Mostly by default collation ILIKE Depends on collation Compare with UPPER()
Update on duplicate ON DUPLICATE KEY UPDATE ON CONFLICT ... DO UPDATE MERGE MERGE
Auto-increment column AUTO_INCREMENT SERIAL, IDENTITY IDENTITY IDENTITY (12c and later)

Strings use single quotes in every dialect. Double quotes also read as a string in the default mode of MySQL and MariaDB, but databases such as PostgreSQL treat them as a column name and fail with errors like column "x" does not exist.

NULL and changes without WHERE

WHERE b = NULL never selects a row, because comparing with NULL using = gives UNKNOWN, neither true nor false. Use IS NULL. An = that assigns, as in UPDATE t SET b = NULL, is fine and is not flagged.

An UPDATE or DELETE without WHERE changes the whole table. That is sometimes intended, so it is a warning and not an error. On a production database it is a good habit to run the same condition as a SELECT first and confirm the row count.

Frequently asked questions

If this passes, will the query run?

There is no guarantee. It only finds visible mistakes in quotes, parentheses and clause structure. Missing tables or columns, type mismatches, permissions and function argument errors are reported by the database at run time.

Can I use it instead of EXPLAIN?

No. EXPLAIN is the database’s own interpretation of the query. This tool is for filtering out common mistakes quickly where no database is available.

Does it check stored procedure and trigger bodies?

Statements are split on semicolons, so each statement inside BEGIN ... END is looked at, but procedural syntax is not understood and false alarms are possible.

How do I make the query easier to read?

Use the formatted output here, or the SQL Formatter for indentation, keyword case and minify options.

Related tools: SQL Formatter, CSV SQL Query, SQLite Viewer, XML Validator, JSON Formatter.

No database is contacted, and your SQL is checked in your browser only and never sent to a server.

Can't find the tool you need?

Tell us what you want to do. We build the most requested tools first.