// data type reference

INTEGER (INT)

4 bytes, +/-2.1 billion, the type everyone reaches for first.

Family
Integers
Missing in
None of the five
Gotchas
4 listed

Engine by engine

INT and INTEGER name a 4-byte type in three engines; Oracle's is a 38-digit NUMBER, and in SQLite only the exact spelling INTEGER PRIMARY KEY aliases the rowid.

INTEGER / INT in SQL Server, PostgreSQL, MySQL, SQLite and Oracle: type name, storage and notes
Motor Tipo Armazenamento Notas
SQL Server INT 4 bytes -2,147,483,648 to 2,147,483,647. INTEGER is an accepted spelling.
PostgreSQL INTEGER (INT, INT4) 4 bytes Three spellings, one 4-byte signed type.
MySQL INT 4 bytes INT(11)-style display width is deprecated since 8.0.17; INT UNSIGNED reaches 4,294,967,295.
SQLite INTEGER up to 8 bytes One integer type covering 1-8 byte values; INTEGER PRIMARY KEY aliases the rowid.
Oracle INTEGER (= NUMBER(38)) 1-21 bytes ANSI INTEGER maps to NUMBER(38), not a 4-byte type; use NUMBER(10) for int-sized columns.

Gotchas

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

  1. Oracle's INTEGER is NUMBER(38) in disguise: 38 digits, variable-length decimal storage, and fractional input rounded rather than rejected (1.5 becomes 2). NUMBER(10) caps it near INT's size.
  2. In SQLite, INT PRIMARY KEY and INTEGER PRIMARY KEY are not the same: only the exact spelling INTEGER makes the key an alias for the rowid. INT PRIMARY KEY creates a separate column plus a unique index.
  3. MySQL's INT(11) is display width, not size: the column is always 4 bytes, and the syntax is deprecated as of MySQL 8.0.17.
  4. The 2.1 billion ceiling arrives faster than expected on event and audit tables: pick BIGINT before the painful migration.

Common questions

Is INT the same as INTEGER?

Almost. SQL Server, PostgreSQL and MySQL treat them as one 4-byte type, and Oracle maps both to NUMBER(38). SQLite gives both INTEGER affinity, but only INTEGER PRIMARY KEY becomes the rowid alias.

Why does Oracle's INTEGER accept huge values?

Because it resolves to NUMBER(38). Oracle treats the ANSI integer names as precision-unlimited numbers; constrain with NUMBER(10,0) to get INT semantics.

// 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.