SQL data type comparison and converter
One table for the types you actually port between SQL Server, PostgreSQL, MySQL, SQLite and Oracle, and a converter that maps a type from one engine to its closest match in the other four. Where storage, precision or behavior differ, it says so.
Convert a type
The converter reads the reference table below, so the two always agree. You only get a warning where the engines really differ: storage size, precision, time zones, empty strings or signedness.
Pick a database and enter a type name, or browse the reference table below.
The cross-engine reference table
Each row is a type you meet in real schemas, mapped to its nearest type in every engine. The small notes under a type are the differences that break migrations. The last column is the general gotcha for the row.
| Tipo | SQL Server | PostgreSQL | MySQL | SQLite | Oracle | Gotchas |
|---|---|---|---|---|---|---|
| Integers | ||||||
| Tiny integer |
TINYINT
Unsigned: holds 0 to 255 only.
|
SMALLINT
No 1-byte type; SMALLINT is 2 bytes and signed.
|
TINYINT
Signed (-128 to 127) unless you add UNSIGNED.
|
INTEGER
No 1-byte type.
|
NUMBER(3)
Allows -999 to 999; add a CHECK for 0 to 255.
|
Range differences bite in migrations: SQL Server's TINYINT holds 0 to 255, MySQL's holds -128 to 127 unless declared UNSIGNED. |
| Small integer |
SMALLINT
|
SMALLINT
|
SMALLINT
|
INTEGER
|
NUMBER(5)
Allows -99,999 to 99,999, wider than a real SMALLINT.
|
Holds -32,768 to 32,767 in SQL Server, PostgreSQL and MySQL; Oracle's NUMBER(5) is wider and SQLite's INTEGER takes any 64-bit value. |
| Inteiro |
INT
|
INTEGER
|
INT
|
INTEGER
|
NUMBER(10)
Oracle's INTEGER is NUMBER(38), not a 4-byte type; NUMBER(10) caps it near INT's range. Both round 1.5 to 2 instead of rejecting it.
|
Oracle's INTEGER is an ANSI alias for NUMBER(38), and in SQLite only INTEGER PRIMARY KEY (not INT PRIMARY KEY) aliases the rowid. |
| Big integer |
BIGINT
|
BIGINT
|
BIGINT
|
INTEGER
SQLite INTEGER is 64-bit already, so it covers bigint.
|
NUMBER(19)
|
JavaScript loses precision past 2^53 and Excel past 15 digits; every engine here stores the full 64-bit range. |
| Decimais | ||||||
| Exact decimal |
DECIMAL(p,s)
|
NUMERIC(p,s)
|
DECIMAL(p,s)
|
NUMERIC
Type affinity only: precision and scale are never enforced.
|
NUMBER(p,s)
|
SQLite stores NUMERIC as an affinity hint, not a rule: the declared precision and scale are never enforced. |
| Single-precision float |
REAL
|
REAL
|
FLOAT
4 bytes; FLOAT(p) with p above 24 becomes an 8-byte DOUBLE.
|
REAL
SQLite stores every REAL as an 8-byte double; there is no true single precision.
|
BINARY_FLOAT
Oracle's REAL and FLOAT keywords mean decimal NUMBER; BINARY_FLOAT is the IEEE type.
|
SQLite has no single-precision storage: REAL is always a double. |
| Double-precision float |
FLOAT
SQL Server FLOAT defaults to FLOAT(53), a double.
|
DOUBLE PRECISION
|
DOUBLE
|
REAL
|
BINARY_DOUBLE
Oracle's DOUBLE PRECISION keyword means FLOAT(126), a decimal NUMBER, not an IEEE double.
|
IEEE 754 doubles everywhere, so arithmetic is still inexact. Use DECIMAL or NUMERIC for money. |
| Money |
MONEY
Keeps 4 decimals through every step: MONEY 1 / 3 * 3 returns 0.9999. DECIMAL(19,4) is the safer choice.
|
NUMERIC(19,4)
PostgreSQL's money type exists but takes its decimals and symbol from lc_monetary; avoid it for storage.
|
DECIMAL(19,4)
|
INTEGER
Store integer cents: NUMERIC affinity keeps 0.10 as an 8-byte float.
|
NUMBER(19,4)
|
SQL Server, PostgreSQL, MySQL and Oracle hold currency exactly in DECIMAL or NUMBER; SQLite has no exact decimal, so store minor units as INTEGER. |
| Caractere | ||||||
| Fixed-length string |
CHAR(n)
|
CHAR(n)
Blank-padded; trailing spaces are ignored in comparisons and dropped when cast to text.
|
CHAR(n)
Trailing spaces are stripped when the value is read back.
|
TEXT
No fixed-length type; a declared length is accepted and ignored.
|
CHAR(n)
n counts bytes unless you write CHAR(n CHAR); maximum 2,000 bytes.
|
Values shorter than n are space-padded in SQL Server, PostgreSQL, MySQL and Oracle, and each engine hides the padding differently. |
| Variable string |
VARCHAR(n)
VARCHAR uses the collation's code page (UTF-8 only with a _UTF8 collation, 2019+); for Unicode text see NVARCHAR(n) below.
|
VARCHAR(n)
|
VARCHAR(n)
The length counts characters, and the engine's row-size cap still applies.
|
TEXT
Any declared length is ignored; values can reach 1 billion bytes by default.
|
VARCHAR2(n)
The length counts bytes unless you write VARCHAR2(n CHAR), and the empty string is stored as NULL.
|
Oracle: VARCHAR2 is the real type, empty strings are stored as NULL, and the length counts bytes unless you add CHAR. |
| Unicode string |
NVARCHAR(n)
UTF-16; n counts byte-pairs and tops out at 4,000, with NVARCHAR(MAX) beyond that. Since SQL Server 2019, VARCHAR with a _UTF8 collation also stores Unicode.
|
VARCHAR(n)
No separate national type: every text column uses the database encoding, usually UTF-8.
|
VARCHAR(n)
utf8mb4, the default character set since MySQL 8.0, covers all of Unicode. MySQL's NVARCHAR means utf8mb3, which cannot hold 4-byte characters such as emoji.
|
TEXT
Every TEXT value is UTF-8 or UTF-16 already; there is no separate national type.
|
NVARCHAR2(n)
Uses the national character set (AL16UTF16 by default), and n counts characters, not bytes.
|
SQL Server (before UTF-8 collations) and Oracle use a separate national type for Unicode; PostgreSQL, MySQL with utf8mb4, and SQLite keep it in ordinary text columns. |
| Unlimited text |
VARCHAR(MAX)
|
TEXT
|
TEXT
MySQL TEXT tops out at 64 KB; LONGTEXT reaches 4 GB.
|
TEXT
|
CLOB
|
MySQL's TEXT is only 64 KB, so pick MEDIUMTEXT or LONGTEXT for long documents. |
| Binário | ||||||
| Binary data |
VARBINARY(MAX)
SQL Server's legacy IMAGE type is deprecated.
|
BYTEA
|
BLOB
BLOB holds 64 KB; MEDIUMBLOB 16 MB, LONGBLOB 4 GB.
|
BLOB
|
BLOB
|
Size ceilings differ: SQL Server 2 GB, PostgreSQL BYTEA 1 GB, MySQL BLOB only 64 KB (LONGBLOB 4 GB), SQLite 1 billion bytes by default. |
| Data e hora | ||||||
| Date only |
DATE
|
DATE
|
DATE
|
TEXT
No native date type: store ISO-8601 text and validate with a CHECK constraint.
|
DATE
Oracle's DATE includes the time of day, down to whole seconds.
|
The classic trap: Oracle's DATE has a time component, and SQLite has no DATE at all. |
| Time only |
TIME
|
TIME
|
TIME
|
TEXT
Store ISO-8601 text such as 13:45:00.
|
(none)
No TIME type: use DATE, TIMESTAMP or INTERVAL DAY TO SECOND.
|
Oracle has no time-only type; store an INTERVAL DAY TO SECOND or a full timestamp. |
| Data e hora |
DATETIME2
Prefer DATETIME2; the old DATETIME has only 3.33 ms accuracy.
|
TIMESTAMP
Without time zone, despite the bare name.
|
DATETIME
Stores the wall clock as written, 1000 to 9999. MySQL's TIMESTAMP converts through the session time zone and ends in 2038.
|
TEXT
Store ISO-8601 text such as 2026-01-31T13:45:00.
|
TIMESTAMP
Up to 9 fractional digits; Oracle's DATE also carries a time, to whole seconds.
|
Same name, different behavior: PostgreSQL's TIMESTAMP never converts, MySQL's TIMESTAMP converts through the session zone and stops at 2038-01-19, and SQL Server's TIMESTAMP is rowversion, not a date. |
| Timestamp with time zone |
DATETIMEOFFSET
|
TIMESTAMPTZ
Stored as UTC; the original zone itself is not kept.
|
TIMESTAMP
Converted between the session time zone and UTC on write and read; no offset is stored, and the range ends 2038-01-19 03:14:07 UTC.
|
TEXT
Store ISO-8601 with the offset, such as 2026-01-31T13:45:00+01:00.
|
TIMESTAMP WITH TIME ZONE
Keeps the offset or a region name such as America/New_York.
|
SQL Server and Oracle keep the offset you supplied; PostgreSQL converts to UTC and drops it; MySQL converts via the session zone and stores no offset. |
| Identifiers and booleans | ||||||
| UUID |
UNIQUEIDENTIFIER
|
UUID
|
BINARY(16)
MySQL 8 stores UUIDs via UUID_TO_BIN(); MariaDB has a real UUID type.
|
TEXT
Store the canonical lowercase form.
|
RAW(16)
|
MariaDB has a native UUID type; in MySQL 8 store BINARY(16) via UUID_TO_BIN(). |
| Booleano |
BIT
Only 0, 1 and NULL.
|
BOOLEAN
|
TINYINT(1)
BOOLEAN is an alias for TINYINT(1).
|
INTEGER
Use 0 and 1; there is no boolean type.
|
BOOLEAN
Oracle 23ai and later; before that, NUMBER(1) with a CHECK (col IN (0, 1)).
|
SQL Server has no TRUE or FALSE literal at all; MySQL and SQLite accept them as 1 and 0, and only PostgreSQL and Oracle 23ai have a real boolean type. |
| Semi-structured | ||||||
| JSON |
NVARCHAR(MAX)
SQL Server 2025 and Azure SQL have a native json type; on 2022 and earlier, validate with ISJSON() in a CHECK constraint.
|
JSONB
Prefer JSONB: binary storage and indexable; JSON keeps the exact input text.
|
JSON
Validated on write and stored in a compact binary form.
|
TEXT
Validate with JSON_VALID() and a CHECK constraint.
|
JSON
Oracle 21c and later (binary OSON); before 21c, a CLOB or VARCHAR2 with an IS JSON check constraint.
|
PostgreSQL JSONB, MySQL JSON, Oracle 21c+ and SQL Server 2025 store parsed binary JSON; SQLite and older SQL Server store text plus a CHECK constraint. |
| XML |
XML
|
XML
|
TEXT
No native XML type; validate in the application.
|
TEXT
|
XMLTYPE
|
SQL Server, PostgreSQL and Oracle reject malformed XML on write; MySQL and SQLite store plain text and check nothing. |
| Chaves | ||||||
| Auto-increment key |
INT IDENTITY(1,1)
|
GENERATED ALWAYS AS IDENTITY
serial is the legacy shorthand; identity is the SQL standard.
|
INT AUTO_INCREMENT
|
INTEGER PRIMARY KEY
Auto-assigns rowids on its own; add AUTOINCREMENT only to stop reuse of deleted ids. INT PRIMARY KEY does not do this.
|
GENERATED ALWAYS AS IDENTITY
Oracle 12c and later; before that, SEQUENCE.NEXTVAL.
|
The syntax differs on every engine, and GENERATED ALWAYS rejects explicit inserts, which matters when you port seed data. |
How to read the warnings
- Storage differences. SQLite's REAL is always an 8-byte double, so a single-precision column grows silently; MySQL's TEXT tops out at 64 KB where PostgreSQL's TEXT reaches 1 GB.
- Precision differences. SQL Server's MONEY keeps four decimal places and rounds; NUMERIC and DECIMAL keep what you declare. SQLite never enforces the declared precision at all.
- Behavior differences. Oracle stores the empty string as NULL, MySQL's TINYINT is signed by default while SQL Server's is unsigned, and TIMESTAMP means three different things in PostgreSQL, MySQL and SQL Server.
- Missing types. Some mappings are approximations. SQLite has no boolean, date or UUID type, and Oracle has no time-only type; the warnings say what to use instead.
SQL data type FAQ
Is this SQL data type comparison free?
Yes. It is free to use with no sign-up and no limits, like the other SQLly web tools. The reference table is the same mapping the converter uses.
How do I convert a type from one database to another?
Pick the source database at the top of the page, then type or pick a type name such as NVARCHAR(50) or TIMESTAMPTZ. The converter shows the closest type in the other four engines, and where storage, precision or behavior differ, a warning next to the type says so plainly.
Is anything I type sent to a server?
No. The reference table is plain HTML and the converter runs in your browser, so nothing you type leaves your device. Once the page has loaded it keeps working offline.
Why does the same type name behave differently across databases?
The names collide but the behavior does not always follow. MySQL's TINYINT is signed while SQL Server's is unsigned, Oracle's DATE includes a time of day, and PostgreSQL's TIMESTAMP has no time zone while MySQL's TIMESTAMP does. The table calls out each of these traps.
What does SQLite use instead of DATE, BOOLEAN or UUID?
SQLite has only five storage classes, so dates, booleans and UUIDs are conventionally stored as TEXT or INTEGER with a CHECK constraint to keep the format honest. The table shows the convention for each.
Why does Oracle use VARCHAR2 instead of VARCHAR?
VARCHAR2 is Oracle's real variable-length type, and it has two quirks: the declared length counts bytes unless you write VARCHAR2(n CHAR), and the empty string is stored as NULL. Plain VARCHAR is accepted as a synonym and behaves the same way.
Should I use MONEY in SQL Server?
Usually not. MONEY keeps four decimal places through intermediate results, so CAST(1 AS MONEY) / CAST(3 AS MONEY) * 3 returns 0.9999; DECIMAL(19,4) widens the scale while it computes. PostgreSQL's money type has the further problem of depending on lc_monetary.
Related on SQLly
- SQL data types: every type, engine by engine Referência
- Cast syntax in SQL Server, PostgreSQL, MySQL, SQLite and Oracle Dialect comparison
- Safe cast that returns NULL instead of an error in SQL Server, PostgreSQL, MySQL, SQLite and Oracle Dialect comparison
- Cast text to a number in SQL Server, PostgreSQL, MySQL, SQLite and Oracle Dialect comparison
- CHAR versus VARCHAR semantics in SQL Server, PostgreSQL, MySQL, SQLite and Oracle Dialect comparison
- Column types for UUIDs and GUIDs in SQL Server, PostgreSQL, MySQL, SQLite and Oracle Dialect comparison
Migrating more than types?
SQLly is a native SQL workbench for macOS, Windows and Linux that connects to all five of these engines, with IntelliSense that knows each dialect and a result grid that behaves.