SQL dialect converter
Rewrite SQL between PostgreSQL, MySQL, SQLite and SQL Server syntax.
SQL dialect converter
Paste a query written for one database and get it back rewritten for another. The converter covers row-limiting syntax, common date and string functions, string concatenation, identifier quoting and column types across PostgreSQL, MySQL, SQLite and SQL Server — useful when migrating a project from MySQL to PostgreSQL, porting a script written for SQL Server to SQLite, or just checking how a query would look in another engine.
Source dialect and target dialect pick the two ends of the conversion. The checkboxes below turn individual conversions on and off: normalize identifier quoting swaps double quotes, backticks and square brackets for the target's own style; convert row limit clause switches between LIMIT, TOP and OFFSET…FETCH FIRST without ever silently dropping an offset; convert date and string functions rewrites NOW()/GETDATE()/datetime('now'), LENGTH()/LEN(), SUBSTRING()/SUBSTR() and COALESCE()/IFNULL()/ISNULL(); convert string concatenation switches between || and CONCAT()/+; convert column types maps SERIAL, AUTO_INCREMENT, IDENTITY(1,1), BOOLEAN, TEXT and TIMESTAMP-style declarations to their nearest equivalent. Keep comments controls whether -- and /* */ comments survive the rewrite.
Some constructs genuinely have no equivalent — PostgreSQL's RETURNING and ON CONFLICT, or MySQL's ON DUPLICATE KEY UPDATE — and rather than guess at a rewrite, the tool leaves them in place and lists them in a warnings block appended to the output. It rewrites statement text rather than parsing a full execution plan, so review the result before running it against a real database, especially for nested subqueries or unusual formatting. Multi-statement scripts work too: each statement separated by a semicolon converts on its own.
Everything runs locally in your browser: no query, table name, column name or connection string is ever sent anywhere. Copy the result, download it as a .txt file, or send the output straight back into the input to run another pass.