SQL Diff
Compare two SQL queries online. Format both, then diff. Whitespace and keyword case do not count as changes. Free SQL compare tool.
Dialect
Left SQL
0 lines · 0 chars
Loading editor...
Right SQL
0 lines · 0 chars
Loading editor...
Features
- Format both queries with the same dialect before comparing
- Ignore keyword case and indent noise
- Line-level added and removed hunks
- Works for SELECT, INSERT, DDL, and scripts
- Nothing is uploaded
Common Use Cases
- See what changed between two versions of a report query
- Compare ORM SQL before and after an upgrade
- Check that a formatter-only change is whitespace
- Review a migration script against last week’s copy
Formatted diff, not EXPLAIN
Both sides are pretty-printed with the same dialect and uppercase keywords, then compared line by line. That hides indent-only edits. It does not prove two queries return the same rows. Semantically equal SQL (a = 1 AND b = 2 vs the reverse) can still show a diff.
Examples
Valid - Same query, different wrap
select id from t; vs SELECT id FROM t; Valid - Real change
WHERE active = true vs WHERE active = falseFrequently Asked Questions
Why is there no diff after I change spaces?
Both queries are formatted first. Indent and keyword case are normalized on purpose.
Can I diff two files of 10k lines?
The LCS diff is fine for typical queries. Multi-megabyte scripts may freeze the tab. Use git diff locally for those.
Tips
- If parse fails, fix quotes on that side first. Diff needs both queries to format.