DiffKit / SQL compare
SQL compare
Paste two queries or migration scripts. Both are formatted the same way for your dialect, so the diff shows what actually changed: columns, joins, filters and limits.
What to look for in a SQL diff
With both queries formatted, each clause sits on its own lines and the changes are easy to review. Pay extra attention to edits that change results without an error:
- JOIN conditions. Moving a filter from
WHEREinto aLEFT JOIN … ONkeeps unmatched rows, as in the example witho.refunded = false. - IN lists and OR. Widening
status = 'active'to anINlist changes row counts. - GROUP BY. Adding a column to
SELECTusually means adding it toGROUP BYas well. - ORDER BY and LIMIT. Together they decide which rows you keep.
Press Explain changes under the diff for a plain-English summary of how the result set will differ, which is useful when a query change goes into a pull request.
Questions people ask
Why format SQL before comparing it?
Two developers rarely lay out the same query the same way. One writes it on a single line, another breaks every clause, and keyword case varies. Formatting both sides with the same rules first means the diff shows only the columns, joins and conditions that really changed.
Which SQL dialects are supported?
Standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery, Snowflake, Redshift and Spark SQL. The formatter comes from the open-source sql-formatter library.
Does this compare database schemas?
It compares SQL text. To compare two schemas, export each one as DDL (for example with pg_dump --schema-only or mysqldump --no-data) and paste both scripts here.
Is my query sent anywhere?
No. Formatting and diffing happen in your browser. Only the optional “Explain changes” button sends the diff to an AI model, and only when you press it.