Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

SQL Dialect Converter (MySQL, PostgreSQL & More)

Translate SQL between ten databases, with each change shown side by side.

Free preview, no sign-upIncluded in your pass Pro tool Pro pass: ₹179 / $5.99 for 30 days On this device: nothing is sent
+3 +1 more details No uploadWorks offline once opened Developer

Free preview: the first lines of the converted SQL (up to 20) and those statements side by side; every warning about your script stays readable. Locked until you unlock it: download and copy.

Pro pass ₹179 for 30 days or ₹79 for 1 week, one‑time. Pro pass $5.99 for 30 days or $2.99 for 1 week, one‑time. How to unlock

Try before you buy.

  • Free preview: the first lines of the converted SQL (up to 20) and those statements side by side; every warning about your script stays readable.
  • Locked until you unlock it: download and copy.
  • Unlock: Pro pass, ₹179 for 30 days or ₹79 for 1 week, a one-time payment that never renews. Unlock: Pro pass, $5.99 for 30 days or $2.99 for 1 week, a one-time payment that never renews.

Ways to unlock shows how to get the full result.

See passes (opens in a new tab)

Printing this result is locked in the free preview.

Bare names follow the target's case rules.

A query, a schema or a whole dump. Drop a .sql file here; it is read in your browser, never uploaded.

Converted SQL

 

Next steps Done. What next?

Start over

A Pro pass unlocks the full result. See passes

All developer tools

About the SQL Dialect Converter (MySQL, PostgreSQL & More)

Convert SQL from one database to another for a migration. Paste a query or a whole script — a schema with CREATE TABLE, CREATE INDEX and ALTER TABLE, data with INSERT, or a dump from mysqldump or pg_dump — choose the source and the target among MySQL (also for MariaDB), PostgreSQL, SQL Server, Oracle, SQLite, BigQuery, Snowflake, Redshift, DuckDB and Spark SQL, and get the script in the target's own SQL.

The converter rewrites what differs: data types with their sizes, identifier quoting, AUTO_INCREMENT, IDENTITY, SERIAL and sequences, LIMIT, TOP and FETCH FIRST, string literals and their escapes, upserts (ON DUPLICATE KEY UPDATE, ON CONFLICT, INSERT IGNORE), RETURNING and OUTPUT, and the common functions: NULL handling, string functions, the clock, date arithmetic and differences (with the unit-boundary rules of each database), date formats, string aggregation and casts. Each statement is shown next to its conversion with the changed parts highlighted.

What it cannot translate — procedures, functions, triggers, procedural blocks, functions only one database has — stays in place, as written, with a warning comment above it; nothing is dropped. Without a pass the page shows a free preview of the first lines; the whole script, its copy and its download unlock with a Pro pass. The script is converted in your browser and never uploaded.

How to use it

  1. Choose the database the SQL is written for and the one it should run on; Swap exchanges the two.
  2. Paste the SQL, open a .sql file or drop one on the box. Example loads a script for the chosen source.
  3. Read the warnings: each one names a line of your script that needs a decision, and the same text sits above the statement in the output.
  4. Compare the statements side by side: removed parts are marked on the left, new parts on the right.
  5. With a pass, copy the converted script or download it as .sql; the free preview shows the first lines. Run it on a test database before production.

Examples

MySQL table to PostgreSQL
Input
CREATE TABLE `users` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `active` TINYINT(1) NOT NULL DEFAULT 1,
  `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB;
Result
CREATE TABLE users (
  id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
  active SMALLINT DEFAULT 1 NOT NULL,
  created_at TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP NOT NULL,
  PRIMARY KEY (id)
);

INT UNSIGNED becomes BIGINT so every value still fits; the ENGINE option has no PostgreSQL meaning and is listed in a note.

Row limits, MySQL to SQL Server
Input
SELECT name FROM users ORDER BY created_at DESC LIMIT 10 OFFSET 20;
Result
SELECT name FROM users ORDER BY created_at DESC OFFSET 20 ROWS FETCH NEXT 10 ROWS ONLY;
Functions, SQL Server to PostgreSQL
Input
SELECT ISNULL(price, 0), LEN(name), DATEADD(day, 7, ordered), DATEDIFF(day, ordered, GETDATE()), name + ' (' + sku + ')' FROM products;
Result
SELECT COALESCE(price, 0), LENGTH(name), (ordered + INTERVAL '7 days'), (CAST(CURRENT_TIMESTAMP AS DATE) - CAST(ordered AS DATE)), name || ' (' || sku || ')' FROM products;

SQL Server's LEN() leaves out trailing spaces; the converter says so in a note.

Oracle DECODE and SYSDATE to MySQL
Input
SELECT DECODE(status, 'A', 'active', 'other'), SYSDATE - 30, NVL(bonus, 0) FROM staff;
Result
SELECT CASE status WHEN 'A' THEN 'active' ELSE 'other' END, DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 30 DAY), COALESCE(bonus, 0) FROM staff;
An upsert, MySQL to PostgreSQL
Input
CREATE TABLE stock (sku VARCHAR(20) PRIMARY KEY, qty INT NOT NULL);
INSERT INTO stock (sku, qty) VALUES ('A1', 5)
ON DUPLICATE KEY UPDATE qty = qty + VALUES(qty);
Result
CREATE TABLE stock (sku VARCHAR(20) PRIMARY KEY, qty INT NOT NULL);
INSERT INTO stock (sku, qty) VALUES ('A1', 5) ON CONFLICT (sku) DO UPDATE SET qty = stock.qty + EXCLUDED.qty;

The key columns of ON CONFLICT come from the CREATE TABLE of stock in the script; without it the converter writes a placeholder and asks you to fill them in.

Common uses

  • Move an application from MySQL or MariaDB to PostgreSQL, schema and data.
  • Load a SQL Server or Oracle schema into a cloud warehouse such as BigQuery, Snowflake or Redshift.
  • Turn a pg_dump or mysqldump file into a script for another database, COPY data included.
  • Port reports and queries when a team changes databases, with every function change explained.

What is converted

  • Data types: integers (unsigned ones one size larger where the target has none), decimals, floats, booleans, strings with their lengths, binary, dates and times with their precision and time zone, JSON, UUID, arrays and structs, enums (as a CHECK of their values).
  • Keys and columns: identity columns in each target's form (AUTO_INCREMENT, IDENTITY, GENERATED AS IDENTITY, SQLite's INTEGER PRIMARY KEY AUTOINCREMENT, a DuckDB sequence), defaults, NOT NULL, primary, unique and foreign keys, checks, generated columns, column and table comments. MySQL's inline indexes become CREATE INDEX.
  • Queries: LIMIT / OFFSET, TOP, FETCH FIRST, FROM DUAL, NULLS FIRST / LAST, UNION DISTINCT, MINUS / EXCEPT, CROSS APPLY / LATERAL, ILIKE, REGEXP and ~, NULL-safe equality.
  • Functions: IFNULL / NVL / ISNULL, IF / IIF / IFF, DECODE, string length, position, substring and padding functions, CONCAT and ||, string aggregation (GROUP_CONCAT, STRING_AGG, LISTAGG), the current date and time, date arithmetic, date differences, EXTRACT and date parts, truncation, month ends, date formats in every format language, casts, random numbers, UUIDs and logarithms.
  • Data: string escapes, TRUE / FALSE where a database has only 0 and 1, multi-row INSERT for Oracle and for SQL Server's 1,000-row limit, upserts, RETURNING and OUTPUT, and pg_dump COPY blocks as INSERT statements.

What stays as written

  • Procedures, functions, triggers, events and procedural blocks (T-SQL, PL/SQL, PL/pgSQL, MySQL's stored-program language): the languages differ too much to convert line by line.
  • Functions only one database has (FIND_IN_SET, STUFF, CONNECT BY, JSON paths …), which are named in a warning.
  • Session settings (SET …), LOCK TABLES and the like from dump headers, which are commented out because they mean nothing elsewhere.

Each of these keeps its place in the script, with a comment above it that says why.

Meaning, not just spelling

Some functions with the same name do different things, and the converter writes what the source means:

  • MySQL's LENGTH counts bytes, SQL Server's LEN leaves out trailing spaces: both are noted.
  • DATEDIFF in SQL Server, Snowflake and Redshift counts the unit boundaries crossed, MySQL's TIMESTAMPDIFF counts whole units: where the target has the other rule, a note says so.
  • MySQL's || is OR; in most other databases it joins strings.
  • CONCAT gives NULL for a NULL argument in MySQL and skips it in PostgreSQL and SQL Server.
  • Oracle's DATE has a time of day, so it becomes a timestamp.
  • SQL Server's TIMESTAMP is a row version, not a date.

Sources

Limitations

  • The converter reads SQL token by token and knows the types of the tables your script creates; it does not connect to a database, so a column it has not seen created is converted by its name alone.
  • Procedural code is kept as written and must be rewritten by hand.
  • Some differences have no automatic answer (case of names in Oracle and Snowflake, collations, time zones, regular-expression flavours): they are listed as notes to check, not hidden.
  • SQL Server statements must end with ; or GO for the converter to tell them apart.
  • Run the converted script on a test database first and compare the results of important queries.

Privacy

On this device: nothing is sent

Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot.

Frequently asked questions

What do I get without a pass?

Without a pass, SQL Dialect Converter (MySQL, PostgreSQL & More) shows the first lines of the converted SQL (up to 20) and those statements side by side; every warning about your script stays readable. Until you unlock it, the result can’t be downloaded or copied. A Pro, Premium or Ultimate pass, a one-time payment that never renews, unlocks the full result. The pricing page lists the passes and their prices.

Is MariaDB supported?

Yes: choose MySQL. MariaDB reads the same SQL for everything the converter writes; where MariaDB has a feature MySQL lacks (sequences, RETURNING), the notes mention it.

Why are some names quoted and others not?

With "Quote only where needed" a name is written bare when that means the same name in the target, and quoted when it is a reserved word there or keeps its case: PostgreSQL folds bare names to lower case, Oracle and Snowflake to upper case. Choose "Quote every quoted name" to keep every quote of your script.

Does it convert a whole mysqldump or pg_dump file?

Yes. Tables, indexes, constraints and the data are converted; pg_dump COPY blocks become INSERT statements, sequences become identity columns, and the dump settings are commented out. Scripts up to 3 million characters are converted in the browser.

What happens to stored procedures and triggers?

They stay in the output exactly as written, with a warning above them: procedural languages differ in syntax, error handling and variables, so a line-by-line translation would look right and run wrong.

Can I trust the date functions?

They follow each manual, including the rules that differ (unit boundaries in DATEDIFF, month ends in Oracle's ADD_MONTHS, UTC in SQLite). Where results can differ, a note says how. Check the queries whose dates matter most on real data.

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.