// data type reference

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.

Family
Integers
Missing in
PostgreSQL
Gotchas
4 listed

Engine by engine

1 byte, 0-255 in SQL Server; signed -128 to 127 by default in MySQL; nowhere else has it, so SMALLINT or NUMBER(3) stands in.

TINYINT in SQL Server, PostgreSQL, MySQL, SQLite and Oracle: type name, storage and notes
Engine Type Storage Notes
SQL Server TINYINT 1 byte Unsigned only: 0 to 255. There is no signed tinyint here.
PostgreSQL no TINYINT - use SMALLINT Workaround 2 bytes (SMALLINT) PostgreSQL's smallest integer is SMALLINT; a domain with CHECK can narrow it.
MySQL TINYINT 1 byte Signed -128 to 127 by default; TINYINT UNSIGNED reaches 0 to 255.
SQLite TINYINT (INTEGER affinity) variable, 1-8 bytes Any type name containing INT gets INTEGER affinity, so TINYINT stores full 64-bit integers.
Oracle NUMBER(3) 1-4 bytes No tinyint; NUMBER(3) allows -999 to 999 in variable-length decimal storage, so add a CHECK for 0-255.

Gotchas

Where the engines disagree. These tend to surface as bugs during a migration or a port.

  1. SQL Server's TINYINT is unsigned (0-255) while MySQL's default is signed (-128 to 127): the same column name holds different ranges.
  2. MySQL's TINYINT(1) is treated as a boolean by many clients, but the (1) is display width only - the column still stores the full tinyint range.
  3. PostgreSQL and Oracle have no 1-byte integer: SMALLINT costs 2 bytes and NUMBER(3) up to 4, and neither stops a 300 from going in without a CHECK constraint.
  4. SQLite accepts the type name but gives it INTEGER affinity, so a TINYINT column happily stores 9,223,372,036,854,775,807.

Common questions

How do I get a 1-byte integer in PostgreSQL?

You cannot. The smallest is SMALLINT at 2 bytes. Add a CHECK constraint or a domain to enforce a smaller range.

What is TINYINT(1) in MySQL?

A TINYINT declared with display width 1. Clients often map it to boolean, but it stores the full signed (or unsigned) tinyint range.

Is SQL Server's TINYINT signed?

No. It only stores 0 to 255. For -128 to 127 you need SMALLINT, which is 2 bytes.

// map types before you move data

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.