SQL data type reference
44 types across SQL Server, PostgreSQL, MySQL, SQLite and Oracle. For each one: what every engine calls it, how much storage it takes, and the differences that turn into bugs, like Oracle's DATE carrying a time of day, SQL Server's TINYINT having no negative values, and Oracle storing an empty string as NULL.
has a type for this has none; the page gives the workaround
Integers
Whole numbers, from tiny counters to 64-bit IDs.
-
TINYINT
TINYINT is the smallest integer type in the engines that have one, and the same name means 0-255 in one engine and -128 to 127 in another.
- SQL Server: has a type
- PostgreSQL: none, workaround given
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
-
SMALLINT
SMALLINT halves INT's storage for columns with a known small range.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
-
INTEGER (INT)
4 bytes, +/-2.1 billion, the type everyone reaches for first.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
-
BIGINT
8 bytes, +/-9.2 quintillion, the safe default for keys and timestamps.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
-
SERIAL and auto-incrementing integers
Five engines, five spellings of the same auto-growing key.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
Exact decimals
Types that store exact values: NUMERIC and DECIMAL, MONEY, money as integer cents, and BIT.
-
NUMERIC and DECIMAL
Exact fixed-point decimals: NUMERIC(p,s) and DECIMAL(p,s).
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
-
MONEY
Native MONEY types exist in only two of the five engines.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: none, workaround given
- SQLite: none, workaround given
- Oracle: none, workaround given
-
Storing money as INTEGER
Store cents, not dollars - the one money recipe that works everywhere.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
-
BIT
One-byte flags in SQL Server, bit strings elsewhere, integers in the rest.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: none, workaround given
- Oracle: none, workaround given
Approximate numbers
Floats and doubles: binary floating point, which trades exactness for range.
-
REAL (FLOAT4)
4 bytes, about 7 significant digits, never for money.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
-
DOUBLE PRECISION (FLOAT8)
8 bytes, about 15 digits, the general-purpose float.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
-
BINARY_FLOAT and binary-float edge cases
Where IEEE floats get weird: NaN, infinity and divide-by-zero per engine.
- SQL Server: none, workaround given
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
-
FLOAT(p)
FLOAT(p) looks like one type with a precision knob. In SQL Server, PostgreSQL and MySQL it picks a 4- or 8-byte IEEE float; in Oracle the same keyword declares a decimal NUMBER.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
Text
CHAR, VARCHAR, TEXT and the engines' size limits and encodings.
-
CHAR(n)
Fixed-length, space-padded strings - and what each engine does with the padding.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
-
VARCHAR and NVARCHAR
The everyday string type, plus the length and encoding traps each engine adds.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
-
TEXT and CLOB
The large-text options, from SQLite's everyday TEXT to Oracle's 128 TB CLOB.
- SQL Server: none, workaround given
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
Binary & blobs
Byte arrays, BLOBs and hex literals.
-
BINARY and VARBINARY
Short byte strings - hashes, UUIDs, tokens - belong in a binary type. The names are close across engines, but padding rules and size ceilings differ in ways that bite.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
-
BLOB (large binary objects)
Storing files and other big byte payloads is the BLOB family's job. The documented maximums matter less than the limits you hit first: packet size, row size and TOAST.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
-
RAW and hex literals
Every engine can express bytes as hex text, but each picked its own literal syntax and its own conversion functions. Moving a script between engines is a translation exercise.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
-
IMAGE and other deprecated binary types
Two engines shipped binary types they later regretted. SQL Server's IMAGE and Oracle's LONG RAW still work, still appear in old schemas, and both block features you probably want.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
Dates & times
Dates, times, timestamps and the time-zone traps.
-
DATE
DATE holds a calendar day with no clock attached. It sounds like the simplest type in SQL, and every engine still manages to disagree about it.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
-
TIME
TIME stores a clock time: hours, minutes, seconds and an optional fractional part. Two engines treat it as a pure time-of-day, MySQL lets it go negative, and two do not have it.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
-
TIMESTAMP (without time zone)
This is the workhorse datetime: a calendar date plus a clock time, with no time zone attached. Each engine names it differently, and SQL Server hijacks the word entirely.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
-
TIMESTAMPTZ (timestamp with time zone)
The zone-aware timestamp is the only datetime type that names a real instant. The engines disagree on whether to keep the offset you gave them or throw it away.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
-
DATETIME2 and SMALLDATETIME
SQL Server ships three datetimes with no zone. DATETIME2 is the modern one, DATETIME is the legacy type that starts in 1753 and rounds to 3.33 ms, and SMALLDATETIME rounds to whole minutes.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
-
INTERVAL YEAR TO MONTH
A year-to-month interval counts calendar months: 3 years, 6 months. It is the only interval that respects calendar length - a month is a month, not 30 days - and only Oracle gives it a real column type.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
-
INTERVAL DAY TO SECOND
A day-to-second interval measures elapsed time: 2 days, 4 hours, 30 minutes. It is what you want for durations, and every engine except Oracle and PostgreSQL makes you fake it.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
Booleans
TRUE and FALSE, and the engines that fake them with integers.
-
BOOLEAN
Of the five engines, only PostgreSQL has a native SQL BOOLEAN in every version. SQL Server uses BIT, MySQL aliases BOOLEAN to TINYINT(1), SQLite stores integers, and Oracle added BOOLEAN to SQL only in 23ai.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
-
Emulating BOOLEAN with BIT, TINYINT(1) and CHAR(1)
Where BOOLEAN does not exist, schemas invent one: a BIT, a TINYINT(1), a CHAR(1) holding Y or N. Each emulation needs a CHECK constraint to behave like a boolean.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
UUIDs & identifiers
UUIDs, identity columns, sequences, and the row and object ids engines keep internally.
-
UUID (universally unique identifier)
A UUID hands out globally unique keys without a round trip to the database: any server, any offline client, no collisions. Only some engines give it a real column type; the rest store a string or a byte array and get along fine.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
-
Auto increment and identity columns
The cheapest primary key is a counter the engine hands out on insert. Every engine has one; every engine spells it differently, and the fine print (gaps, explicit values, one-per-table rules) differs more than the syntax suggests.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
-
CREATE SEQUENCE: standalone number generators
A sequence is a number generator that belongs to the schema, not to one column: several tables can draw from it, and application code can too. It is the standard answer to 'I need IDs without a row' and it is missing from two of the five engines.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: none, workaround given
- SQLite: none, workaround given
- Oracle: has a type
-
Rowids and hidden row identifiers
Under every heap and table there is a physical handle for a row: an address you can select, sometimes select by, and never build an API on, because rows move and ids get reused.
- SQL Server: none, workaround given
- PostgreSQL: has a type
- MySQL: none, workaround given
- SQLite: has a type
- Oracle: has a type
-
OIDs and other internal system identifiers
Engines need internal ids for their own objects and transactions: PostgreSQL's OID is the famous one, Oracle's XID names a transaction, and the others keep such bookkeeping out of your SQL.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: none, workaround given
- SQLite: has a type
- Oracle: has a type
JSON & semi-structured
JSON and JSONB, XML, array columns and key-value storage.
-
The JSON column type
Half the engines give JSON a real type that validates and parses on write; the other half store text and call functions on read. Same data, very different write-time guarantees and index options.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
-
JSONB and binary JSON storage
JSONB means parse once on write, query fast on read. PostgreSQL coined the name, MySQL's JSON already works that way, SQLite added a JSONB blob format in 3.45, and SQL Server got a binary json type in 2025.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: has a type
- Oracle: has a type
-
The XML column type
JSON pushed XML out of new designs, but the columns still exist: SQL Server and Oracle have real XML types with query support, the rest store text and hope.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: none, workaround given
- SQLite: none, workaround given
- Oracle: has a type
-
Array columns
A column that holds a list is genuinely useful for tags and small fixed sets. PostgreSQL makes it a first-class type; Oracle offers collections; SQL Server, MySQL and SQLite make you model it another way.
- SQL Server: none, workaround given
- PostgreSQL: has a type
- MySQL: none, workaround given
- SQLite: none, workaround given
- Oracle: has a type
-
Hstore: key-value storage
hstore is PostgreSQL's original key-value column: a flat map of text to text, indexable with GIN. JSONB does most of its job now, and the other engines never had a name for it at all.
- SQL Server: none, workaround given
- PostgreSQL: has a type
- MySQL: none, workaround given
- SQLite: none, workaround given
- Oracle: none, workaround given
Other types
The rest: enums, composite types, spatial points, IP addresses and intervals.
-
ENUM and enumerated types
PostgreSQL puts the value list in a schema type, MySQL puts it on the column, Oracle 23ai has enum domains, and SQL Server and SQLite make you use a CHECK constraint or lookup table.
- SQL Server: none, workaround given
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: none, workaround given
- Oracle: has a type
-
Composite, table and object types
Define your own row shape once, use it as a column type, a function parameter, or a table of rows. PostgreSQL, SQL Server and Oracle each own a flavor; MySQL and SQLite have nothing to translate it into.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: none, workaround given
- SQLite: none, workaround given
- Oracle: has a type
-
Point and basic spatial types
A coordinate pair seems simple, and every engine stores one differently: PostgreSQL's built-in POINT is plain 2-D geometry, while MySQL, SQL Server, Oracle and SpatiaLite spatial types carry an SRID.
- SQL Server: has a type
- PostgreSQL: has a type
- MySQL: has a type
- SQLite: none, workaround given
- Oracle: has a type
-
IP address types (INET/CIDR)
An IP column sorted as text sorts wrong: '10.0.0.9' after '10.0.0.10'. PostgreSQL fixes this with INET; the other engines fix it with binary packing functions you have to remember to use.
- SQL Server: none, workaround given
- PostgreSQL: has a type
- MySQL: none, workaround given
- SQLite: none, workaround given
- Oracle: none, workaround given
-
Interval types (spans of time)
'How long' is data: PostgreSQL and Oracle give durations a real type, while SQL Server, MySQL and SQLite store a number and remember which unit it counts.
- SQL Server: none, workaround given
- PostgreSQL: has a type
- MySQL: none, workaround given
- SQLite: none, workaround given
- Oracle: has a type
No type matches that. Try the engine's own spelling (INT4, VARCHAR2) or
convert it in the type converter.
Map a type to the other four engines
The free type converter maps a type from one engine to its closest equivalent in the others and says where storage, precision or behaviour differ. The desktop app does the same mapping while you edit.