Home › Developer Tools › SQL Dialect Converter

SQL Dialect Converter

Paste a query, a CREATE TABLE statement or a whole script and translate it from one SQL dialect to another: MySQL, PostgreSQL, SQLite, SQL Server, Oracle, BigQuery, Snowflake, Redshift, DuckDB, Spark, Presto/Trino, ClickHouse and more. Features with no equivalent in the target database are listed so you know exactly what to fix by hand.

Last updated:

Quick rules preview

Your SQL never leaves the browser. Convert SQL loads the open-source sqlglot transpiler (Python, run locally with Pyodide, about 12 MB once, then cached); quick rules work instantly without it.

Advertisement
Advertisement

How to use the SQL Dialect Converter

  1. Choose the source and target dialects, for example MySQL to PostgreSQL. The swap button reverses them.
  2. Paste your SQL or open a .sql file. A quick-rules translation appears immediately.
  3. Press Convert SQL to load the full sqlglot engine (once, about 12 MB) for a complete parse and a formatted result.
  4. Read the Unsupported and Notes lists under the panes and adjust anything the target database cannot express.
  5. Copy or download the converted SQL and test it on your database.

Common differences between SQL dialects

TaskMySQLPostgreSQLSQL ServerOracleSQLite
Quote an identifier`name`"name"[name]"NAME""name"
First 10 rowsLIMIT 10LIMIT 10SELECT TOP 10FETCH FIRST 10 ROWS ONLYLIMIT 10
Current date and timeNOW()NOW()GETDATE()SYSTIMESTAMPCURRENT_TIMESTAMP
Null fallbackIFNULL(a, b)COALESCE(a, b)ISNULL(a, b)NVL(a, b)IFNULL(a, b)
String lengthCHAR_LENGTH(s)LENGTH(s)LEN(s)LENGTH(s)LENGTH(s)
Join stringsCONCAT(a, b)a || ba + ba || ba || b
Aggregate stringsGROUP_CONCAT(x)STRING_AGG(x, ',')STRING_AGG(x, ',')LISTAGG(x, ',')GROUP_CONCAT(x)
Auto-increment keyAUTO_INCREMENTGENERATED … AS IDENTITYIDENTITY(1,1)GENERATED … AS IDENTITYINTEGER PRIMARY KEY
Boolean columnTINYINT(1) / BOOLEANBOOLEANBITNUMBER(1)INTEGER
UpsertON DUPLICATE KEY UPDATEON CONFLICT … DO UPDATEMERGEMERGEON CONFLICT … DO UPDATE

Tips for a smooth migration

  • Convert the schema first. Translate CREATE TABLE statements, create the tables, then convert the queries that use them, so type errors surface early.
  • Watch implicit behavior. MySQL compares strings case-insensitively by default while PostgreSQL does not; empty strings are NULL in Oracle; integer division truncates in PostgreSQL and SQL Server.
  • Quote consistently. PostgreSQL folds unquoted names to lower case and Oracle to upper case, so a name created in quotes must always be quoted. The Quote all identifiers option keeps the original case.
  • Test paging and dates. OFFSET/FETCH needs ORDER BY in SQL Server, and date functions rarely map one-to-one.
  • Tidy before and after: run the result through the SQL Formatter, and try small queries in the SQL Online Compiler.

Frequently asked questions

How does the SQL dialect converter work?

Convert SQL runs sqlglot, an open-source Python library that parses SQL into a syntax tree and writes it back out in another dialect. It runs inside your browser through Pyodide, so your queries are never uploaded. Before that engine loads, a built-in set of quick rules handles the most common differences instantly.

Can it convert MySQL to PostgreSQL?

Yes. Typical changes include backtick identifiers to double quotes, AUTO_INCREMENT to GENERATED BY DEFAULT AS IDENTITY, DATETIME to TIMESTAMP, TINYINT(1) to BOOLEAN, IFNULL to COALESCE, LIMIT offset, count to LIMIT … OFFSET, and removing ENGINE and CHARSET table options. ON DUPLICATE KEY UPDATE is flagged so you can rewrite it as ON CONFLICT.

How is LIMIT converted for SQL Server and Oracle?

SQL Server uses SELECT TOP n for a simple limit and OFFSET m ROWS FETCH NEXT n ROWS ONLY for paging, which requires an ORDER BY clause. Oracle 12c and later use OFFSET … FETCH FIRST n ROWS ONLY; older versions need ROWNUM.

What does "unsupported" mean in the results?

It marks a feature the target database cannot express directly, for example RETURNING in MySQL, FULL OUTER JOIN in MySQL, or MySQL's ON UPDATE CURRENT_TIMESTAMP elsewhere. The converter keeps the closest output it can and lists these so you can rewrite them by hand.

Will stored procedures and triggers convert?

Procedural code (PL/SQL, T-SQL batches with variables and control flow, PL/pgSQL functions) differs too much between databases for automatic translation. The converter is built for queries, DML and DDL such as CREATE TABLE, CREATE VIEW and INSERT.

Is my SQL sent to a server?

No. The page itself does the conversion. The only network use is downloading the Pyodide runtime and the sqlglot package from public CDNs the first time you press Convert SQL; your SQL text stays in the browser.

Why do date functions need review?

Date arithmetic and formatting are among the least standardized parts of SQL: DATEADD, DATE_ADD, INTERVAL arithmetic, DATE_FORMAT, TO_CHAR and strftime all take different arguments. sqlglot converts many of them, but always test date logic and time zones on the target database.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

SQL Formatter & BeautifierFormat, beautify or minify SQL queries for MySQL, PostgreSQL and more.SQL Online CompilerRun SQL queries online on SQLite with sample databases, a result grid, CSV export and .db save.CSV to SQL ConverterConvert CSV to SQL CREATE TABLE and INSERT statements for MySQL, PostgreSQL, SQLite or SQL Server.SQL Query BuilderBuild SELECT queries visually: joins, filters, GROUP BY, ORDER BY and LIMIT, as clean SQL.JSON to Excel ConverterTurn JSON into a styled .xlsx spreadsheet; nested arrays become their own linked sheets.JSON to CSVConvert JSON data to CSV for spreadsheets.CSV to JSONConvert CSV data to JSON with live preview.Excel to CSVConvert XLSX spreadsheets to CSV.CSV ViewerOpen a CSV or TSV file as a sortable, filterable table.Excel Viewer (XLSX / XLS)Open XLSX, XLS and ODS spreadsheets in your browser without Excel.Line Ending ConverterConvert text and files between CRLF, LF and CR line endings.Markdown to HTMLConvert Markdown to clean HTML with a live editor.XML to JSONConvert XML to JSON with validation.Text Encoding ConverterDetect and convert text file encodings like UTF-8, UTF-16 and Latin-1.JSON ViewerExplore JSON as a collapsible tree, search keys and values and copy any node's path.TTF to WOFF2 ConverterConvert TTF and OTF fonts to WOFF2 or WOFF and get a ready @font-face CSS snippet.Chmod CalculatorConvert Linux file permissions between checkboxes, octal (755) and symbolic (rwxr-xr-x) notation.JSON to TypeScriptGenerate TypeScript interfaces or types from JSON, with nested types and optional fields.Morse Code TranslatorTranslate text to Morse code and back, then play it as sound or a blinking light, or save a WAV.HTML Table GeneratorBuild HTML tables in an editable grid with styles, header rows, CSV import and live preview.Hex to Text ConverterConvert hex to text and text to hex with UTF-8 support and space, 0x, \x or comma formats.JSON to XML ConverterConvert JSON to well-formed XML with attributes, arrays and pretty print.JSON to YAML ConverterConvert JSON to clean YAML as you type, with indent, quoting and sort options.YAML to JSON ConverterConvert YAML to pretty or minified JSON, with errors pinned to the exact line.HTML to Markdown ConverterTurn HTML or pasted rich text into clean Markdown with tables and live preview.Markdown Table GeneratorBuild Markdown tables in a grid or paste from Excel/CSV, with alignment and preview.JSON ValidatorCheck JSON with the exact line and column of each error, fix tips and one-click auto-fix.Image to Base64Convert images to Base64 data URIs, CSS backgrounds and HTML img tags in your browser.Base64 to ImagePaste a Base64 string or data URI to preview, identify and download the image.JSON CompareCompare two JSON documents and see every added, removed and changed path.Hex to DecimalConvert hex to decimal instantly with steps and signed mode.Decimal to HexConvert decimal to hex instantly with steps and signed mode.Binary to DecimalConvert binary to decimal instantly with steps and signed mode.Decimal to BinaryConvert decimal to binary instantly with steps and signed mode.Two's Complement CalculatorDecimal to two's complement binary and back for 4-64 bits, with invert-and-add-1 steps.XML to CSV ConverterConvert XML to CSV: detects repeating records, flattens nested data, pick your columns.CSV to XML ConverterConvert CSV to well-formed XML with custom root and row names, escaping and pretty print.TOML to JSON ConverterConvert TOML to JSON and JSON to TOML with a full v1.0 parser and clear error lines.Endianness ConverterSwap byte order of 16, 32 and 64-bit hex values and see big- and little-endian integers and floats.Excel to SQL ConverterTurn an Excel sheet into CREATE TABLE and INSERT statements for MySQL, PostgreSQL, SQLite or SQL Server.Excel to VCF ConverterTurn an Excel contact list into a vCard .vcf file for iPhone, Android, Google or Outlook.File to C ArrayConvert any file into a C or C++ byte array header, like xxd -i, with const and PROGMEM options.Image to C ArrayConvert images to monochrome, RGB565 or RGB888 C arrays for OLED, LCD and TFT displays.JSON Merge ToolDeep-merge two or more JSON objects with array concat, replace or union and a conflict rule.JSONL to CSV ConverterConvert JSON Lines / NDJSON to CSV with flattened columns; streams large files locally.PHP Unserialize OnlineDecode PHP serialize() strings to JSON, a tree or print_r, and serialize JSON back to PHP.TSV to JSON ConverterTurn tab-separated data pasted from Excel or Sheets into a JSON array or keyed object.XLS to XLSX ConverterConvert old Excel 97-2003 .xls workbooks to modern .xlsx files in your browser, several at once.XML to Excel ConverterTurn repeating XML elements into an .xlsx spreadsheet with attributes and nested data as columns.XSD to XML Sample GeneratorGenerate a sample XML document from an XSD schema, with types, attributes and namespaces.YAML to CSV ConverterTurn a YAML list of objects into CSV with dot-notation columns, custom column order and download.DOCX to Markdown ConverterConvert Word .docx to clean Markdown with headings, lists, tables, links and images in a ZIP.ES6 to ES5 ConverterTranspile modern JavaScript (ES2015+) to ES5 with Babel: targets, module format and loose mode.JavaScript Object to JSONTurn JS object literals and Python dicts into valid JSON: quotes keys, fixes commas and values.JSON Graph VisualizerSee JSON as an interactive node graph with zoom, collapse and search; export PNG or SVG.KML ViewerOpen KML and KMZ files on an interactive map: placemarks, paths, polygons, folders, export.MySQL to PostgreSQL ConverterConvert MySQL dumps and CREATE TABLE statements to PostgreSQL: types, AUTO_INCREMENT, ENUMs, quotes.Text to CSV ConverterTurn space-aligned, fixed-width, pipe or tab separated text into clean CSV with a live preview.VCF File ViewerOpen vCard .vcf files as contact cards with photos, search and duplicate check, export CSV.XML ViewerBrowse XML as a collapsible tree with search, XPath of any node, attributes and big-file support.JSON to Go StructTurn JSON into Go structs with inferred types, nested structs and json tags.JSON to Python ClassGenerate Python dataclasses, Pydantic models or TypedDicts with type hints from JSON.JSON to C# ClassConvert JSON to C# classes or records with System.Text.Json or Newtonsoft attributes.JSON SorterSort JSON keys A-Z recursively, sort arrays by value or by a key, then pretty-print or minify.JSON to HTML TableConvert a JSON array of objects into clean HTML table code with CSS styles and a live preview.IPv4 to IPv6 ConverterConvert IPv4 to IPv4-mapped, 6to4 and NAT64 IPv6, extract IPv4 from IPv6, and get int/hex/binary.cURL to Code ConverterConvert curl commands to JavaScript fetch, Axios, Python requests, Node.js, PHP and Go code.Code to ImageTurn code into a beautiful syntax-highlighted PNG with themes, window frame and background.
See all 129 Data & File Format Converters →