Rewrite common SQL dialect syntax for review

Rewrite a documented subset of MySQL, PostgreSQL, or SQLite syntax as a migration draft for manual review.

freeworks offlinenothing uploaded
ToolSQL Dialect Converter
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

Lexical replacements change identifier quotes, common identity declarations, selected primitive types, LIMIT offsets, and a few named functions between the chosen dialects. The output is labelled for review because the substitutions do not parse SQL grammar or establish equivalent database behaviour.

  • MySQL to PostgreSQL is the initial control direction only; the source and target are explicit, and choosing the same dialect returns the statement unchanged.

Worked example

Rewrite a MySQL identity column for PostgreSQL
Change backtick quoting, AUTO_INCREMENT, TINYINT(1), and the table engine clause
Input
											Input: CREATE TABLE `users` (
  `id` INT AUTO_INCREMENT PRIMARY KEY,
  `active` TINYINT(1) DEFAULT 1
) ENGINE=InnoDB;
From: mysql
To: postgresql
										
Output
												-- Converted from MYSQL to POSTGRESQL
-- Please review for accuracy

CREATE TABLE "users" (
  "id" INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
  "active" BOOLEAN DEFAULT 1
) ;
											

When to use this

Schema-migration drafts translate AUTO_INCREMENT, query reviews rewrite LIMIT offsets, and SQLite prototypes replace unsupported storage type names before testing.

Edge cases

  • The word BOOLEAN inside a quoted SQL string can be changed because lexical replacement does not understand literals.
  • A PostgreSQL cast such as amount::numeric(10,2) loses the cast when converted to the limited MySQL subset.
  • GROUP_CONCAT and STRING_AGG have different argument and ordering forms, so renaming the function cannot prove equivalent aggregation.

References