SQL Quest › Free SQL tools › SQL Query Checker
SQL query checker
Paste a query. It points out the mistakes that return the wrong rows or fail to run — NOT IN with NULLs, a window function in WHERE, a LEFT JOIN that quietly became an INNER JOIN — and says how to fix each one.
What it looks for
NOT IN over a subquery that can return NULL
If the subquery returns one NULL, NOT IN is never true and the query returns no rows. NOT EXISTS does not have this trap.
= NULL instead of IS NULL
A comparison with NULL is unknown, not true, so the filter silently drops every row.
A window function in WHERE
WHERE runs before ROW_NUMBER, RANK and the other window functions exist. Rank in a CTE, filter outside it.
An aggregate in WHERE
COUNT and SUM belong in HAVING, which runs after GROUP BY.
A column that is neither grouped nor aggregated
PostgreSQL rejects it. MySQL and SQLite quietly return an arbitrary row from each group, which is worse.
A WHERE filter on the right side of a LEFT JOIN
Unmatched rows carry NULL there, fail the filter and vanish: the LEFT JOIN has become an INNER JOIN.
Tables listed with commas and no join condition
That is a cross join — every row paired with every row.
Integer division in a rate
COUNT / COUNT truncates in PostgreSQL and SQLite, so a 40% rate comes back as 0.
LIMIT without ORDER BY
Which rows come back is not defined and can change between runs.
Unbalanced parentheses, unclosed quotes, stray commas
The syntax slips that stop a query from running at all.
It reads the SQL text — it does not connect to a database or see your data. A query can pass every check and still answer the wrong question, which is what a grader against real tables is for.
These are the mistakes interviews are built to catch.
SQL Quest grades your query against real tables and tells you which rows are wrong, then builds your practice around the skills you miss. Ten questions find the weakest one.
Questions
Does the SQL query checker run my query?
No. It reads the text of the query in your browser and never sends it anywhere. That means it catches the mistakes visible in the SQL itself, not ones that depend on your data — to test a query against real tables, solve it in the SQL Quest editor.
Which SQL dialects does it support?
The checks are about standard SQL behaviour that PostgreSQL, MySQL, SQLite, SQL Server, BigQuery and Snowflake share: how NULL compares, when WHERE runs, what GROUP BY requires. Where a dialect differs, the message says so.
Why is NOT IN with a subquery flagged?
If the subquery returns even one NULL, NOT IN evaluates to unknown for every row and the query returns nothing. NOT EXISTS gives the answer you meant. It is a classic trap in SQL interview questions about customers who never ordered.