Skip to content
ohsudo

SQL Dialect Reference

The same operation in PostgreSQL, MySQL, MariaDB, SQL Server, Oracle and SQLite, side by side — checked syntax with version notes.

● Runs 100% in your browser — nothing you type leaves this page.

ⓘ This is a reference, not a converter: pick an operation and see the exact syntax for each engine. It does not translate free text.

Syntax works on these versions or newer, unless marked “since”: PostgreSQL 13+ · MySQL 8.0+ · MariaDB 10.6+ · SQL Server 2017+ · Oracle 19c+ · SQLite 3.35+

PostgreSQL and SQLite examples are run automatically on the real engines (PostgreSQL 18.6, SQLite 3.54.0). MySQL, MariaDB, SQL Server and Oracle examples follow each vendor’s documentation.

Show engines

Querying

Return only the first N rows

Get the 5 highest salaries.

PostgreSQL 13+

SELECT first_name, salary
FROM employees
ORDER BY salary DESC
LIMIT 5;

MySQL 8.0+

SELECT first_name, salary
FROM employees
ORDER BY salary DESC
LIMIT 5;

MariaDB 10.6+

SELECT first_name, salary
FROM employees
ORDER BY salary DESC
LIMIT 5;

SQL Server 2017+

SELECT TOP (5) first_name, salary
FROM employees
ORDER BY salary DESC;

Oracle 19c+

since 12c
SELECT first_name, salary
FROM employees
ORDER BY salary DESC
FETCH FIRST 5 ROWS ONLY;

Before 12c: filter on ROWNUM in an outer query.

SQLite 3.35+

SELECT first_name, salary
FROM employees
ORDER BY salary DESC
LIMIT 5;

The address bar updates as you go, so you can bookmark or share the result.

What this is — and what it isn’t

This page is a side-by-side reference. Pick an operation — “return the first N rows”, “auto-increment primary key”, “give read-only access to a table” — and you see the exact syntax for six engines, with the minimum version and the gotchas worth knowing.

It is not an automatic converter: you can’t paste arbitrary SQL and get it translated. Automatic translation between dialects is never 100% reliable, and a wrong GRANT or MERGE in production is expensive. Every example here was written and checked on purpose.

How the examples are checked

All examples use the same tables (employees, departments, projects), so you can compare the engines line by line.

Versions covered

Unless an example says “since …”, it works on: PostgreSQL 13+, MySQL 8.0+, MariaDB 10.6+, SQL Server 2017+, Oracle 19c+ and SQLite 3.35+. Newer features — like IF EXISTS and BOOLEAN in Oracle 23ai — are marked.

Shell, we have a problem!

The differences that bite most often in real migrations: || means OR in MySQL, Oracle treats an empty string as NULL, TRUNCATE can’t be rolled back in MySQL and Oracle, and SQL Server’s DATEDIFF takes its arguments in the opposite order from MySQL’s.

Articles

Learn more