SQL Dialect Converter
Adjust the syntax differences when moving a query between MySQL, PostgreSQL and SQLite.
What is SQL Dialect Converter?
A dialect translator for the parts of SQL that differ between MySQL, PostgreSQL and SQLite. It rewrites the constructs it can prove, and reports the ones where a mechanical rewrite would be wrong.
How it works
Tokens are walked with an eye on their context: backtick-quoted identifiers become double-quoted ones (and the reverse, only where the quote is used as an identifier), AUTO_INCREMENT becomes SERIAL or IDENTITY, `LIMIT offset, count` becomes `LIMIT count OFFSET offset`, and MySQL-only column and table options are dropped with a note explaining the trade-off.
- Paste the source. Drop in code, a stylesheet, a query or a selector list. Everything is read locally — the page never uploads what you paste.
- Choose the options. Indent width, quote style, keyword case or target browsers. The result updates as you change them, so you can see the effect immediately.
- Copy or download. Copy the result to the clipboard or download it as a file. Reset clears the form and returns every option to its default.
Examples
A MySQL schema moved to PostgreSQL
INT UNSIGNED AUTO_INCREMENT becomes an identity column, ENGINE=InnoDB DEFAULT CHARSET is removed, and the notes explain that UNSIGNED no longer restricts the range.
Report queries moved from PostgreSQL to SQLite
NOW() becomes CURRENT_TIMESTAMP and IFNULL/GROUP_CONCAT are mapped, while JSONB columns and ILIKE are flagged as things to rewrite by hand.
Common mistakes
Expecting a formatter to fix invalid code
Formatting is whitespace and quoting. A missing brace, an unclosed tag or an unquoted variable survives the round trip and is reported instead — check the findings list.
Minifying without running the tests afterwards
Even a safe, non-mangling minifier can expose an existing automatic-semicolon-insertion bug. The JavaScript Minifier keeps the newlines that matter, but re-run your tests before shipping.
Treating a rewritten query as verified
The SQL Dialect Converter translates the syntax it can prove; data types, casts and function differences are listed for review, not guessed. Run the converted query against a real database.
Renaming or reformatting generated files
Regenerating a formatter's output is a no-op only if the formatter is the same one that produced it. Keep generated code out of the round trip and format the source it came from.
Frequently asked questions
Will it convert my data types?
No, and deliberately so. SERIAL and IDENTITY are inlined because the mapping is unambiguous, but JSONB, ARRAY, UUID and TIMESTAMPTZ have no SQLite equivalent and ENUM differs between MySQL and PostgreSQL — those are listed as notes instead of silently approximated.
Why was my double-quoted value left alone?
In MySQL, "…" is a string literal by default, not an identifier. Only double-quoted values in identifier positions (after FROM, JOIN, INTO, ON, AS and similar) are converted to backticks; anything else might be a string, so it stays.
Can I convert between MySQL and MariaDB?
They share the syntax this tool targets, so choose MySQL for both. MariaDB-specific features (sequences, RETURNING on inserts) are outside the rule set and are copied as written.