SQL Dialects Reference/Data structure definition/Data types/Numeric types

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

This page includes comparison tables which can be big and complex.

While it's perfectly all right to view them in their complete state, it is recommended to install a comparison tables extension that would allow to select particular columns of interest for comparison.

Feature DB2 Firebird Ingres MSSQL MySQL Oracle PostgreSQL SQLite Virtuoso Linter
Integer (1 byte) N/A N/A TINYINT,
INTEGER1
TINYINT (always unsigned) TINYINT TINYINT "char" (including quotation marks) TINYINT N/A N/A
Integer (2 bytes) SMALLINT SMALLINT SMALLINT,
INTEGER2
SMALLINT SMALLINT SMALLINT SMALLINT SMALLINT SMALLINT SMALLINT
Integer (3 bytes) N/A N/A N/A MEDIUMINT MEDIUMINT N/A N/A MEDIUMINT N/A N/A
Integer (4 bytes) INT
INTEGER
INTEGER INTEGER,
INTEGER4
INT INT INT,
INTEGER
INT,
INTEGER,
INT4
INTEGER INT,
INTEGER
INT,
INTEGER
Integer (8 bytes) BIGINT BIGINT BIGINT,
INTEGER8
BIGINT BIGINT NUMBER(19) BIGINT, INT8 BIGINT N/A BIGINT
Float (single precision, 4 bytes) REAL FLOAT REAL,
FLOAT4
REAL
FLOAT(24)
FLOAT REAL REAL FLOAT,
REAL
REAL FLOAT,
REAL,
FLOAT(n), n≤24
Float (double precision, 8 bytes) DOUBLE,
DOUBLE PRECISION,
FLOAT
DOUBLE PRECISION DOUBLE PRECISION,
FLOAT,
FLOAT8
FLOAT DOUBLE FLOAT,
DOUBLE PRECISION
DOUBLE PRECISION,
FLOAT8
DOUBLE,
DOUBLE PRECISION
FLOAT DOUBLE,
DOUBLE PRECISION,
FLOAT(n), n>24
Fixed precision (p) and scale (s) number DECIMAL(p, s)
NUMERIC(p, s)
DECIMAL(p, s)
NUMERIC(p, s)
DECIMAL(p, s)
NUMERIC(p, s)
DECIMAL(p, s)
NUMERIC(p, s)
DECIMAL(p, s)
NUMERIC(p, s)
DECIMAL(p, s)
NUMERIC(p, s)
DECIMAL(p, s)
NUMERIC(p, s)
NUMERIC(p, s) DECIMAL(p, s)
NUMERIC(p, s)
DECIMAL(p, s)
DEC(p,s)
NUMERIC(p, s)
NUMBER(p,s)
Fixed precision p and s limits p ≤ 31, 0 ≤ s ≤ p p ≤ 31, 0 ≤ s ≤ p p ≤ 38, 0 ≤ s ≤ p p ≤ 65, 0 ≤ 30 ≤ s ≤ p p ≤ 38, 0 ≤ s ≤ p p ≤ 1000 None, numbers stored as strings p ≤ 30, 0 ≤ s ≤ p, s ≤10, p-s≤20
UNSIGNED support No No No No Yes Yes No No No No
Set display width in integer No No No No Yes No No Yes No No