The table below shows all the built-in general-purpose SQL data type names including supported aliases.
Name | Aliases | Description |
---|---|---|
CHARACTER | CHARACTER(1), CHAR, CHAR(1) | UTF-8 character string of max 1 character |
CHARACTER ( length ) | CHAR( length ) | UTF-8 character string with length upperbound limit. Warning: NO spaces are padded at the end |
CHARACTER VARYING ( length ) | VARCHAR ( length ) | UTF-8 character string with length upperbound limit |
CHARACTER LARGE OBJECT | CLOB, TEXT, STRING | UTF-8 character string with unbounded length |
CHARACTER LARGE OBJECT ( length ) | CLOB ( length ), TEXT ( length ), STRING ( length ) | UTF-8 character string with length upperbound limit |
BINARY LARGE OBJECT | BLOB | bytes string with unbounded length |
BINARY LARGE OBJECT ( length ) | BLOB ( length ) | bytes string with length upperbound limit |
BOOLEAN | BOOL | logical boolean (true or false) |
TINYINT | 8 bit signed integer between -127 and 127 | |
SMALLINT | 16 bit signed integer between -32767 and 32767 | |
INTEGER | INT, MEDIUMINT | 32 bit signed integer between -2147483647 and 2147483647 |
BIGINT | 64 bit signed integer between -9223372036854775807 and 9223372036854775807 | |
HUGEINT | 128 bit signed integer between -2^127 +1 and +2^127 -1 (±170141183460469231731687303715884105727) | |
Note: HUGEINT is only available on platforms with a C-compiler that supports the __int128 or __int128_t data type (e.g. recent gcc, clang and icc on Linux or macOS) | ||
DECIMAL | DEC, NUMERIC | Exact signed decimal number with precision 18 and scale 3 |
DECIMAL ( Prec ) | DEC ( Prec ), NUMERIC ( Prec ) | Exact signed decimal number with the specified precision Prec and scale 0. Prec must be between 1 and 18 (or 38 when HUGEINT is also supported) |
DECIMAL ( Prec , Scale ) | DEC ( Prec , Scale ), NUMERIC ( Prec , Scale ) | Exact signed decimal number with specified precision Prec and scale Scale. Prec must be between 1 and 18 (or 38 when HUGEINT is also supported). Scale must be between 0 and Prec |
REAL | FLOAT(24) | 32 bit signed floating point approximate number |
DOUBLE PRECISION | DOUBLE, FLOAT, FLOAT(53) | 64 bit signed floating point approximate number |
FLOAT ( Prec ) | 32 or 64 bit signed floating point approximate number with binary (radix 2) precision Prec. Prec must be between 1 and 53. FLOAT(24) is same as REAL, FLOAT(53) is same as DOUBLE PRECISION | |
DATE | Gregorian calendar date (YYYY-MM-DD) | |
TIME | TIME(0) | time of day (HH:MI:SS) between 00:00:00 and 23:59:59 |
TIME ( Prec ) | time of day including fractions of a seconds (HH:MI:SS.fffffffff). Prec defines the number of fraction digits between 0 and 9 | |
TIME WITH TIME ZONE | TIME(0) WITH TIME ZONE | time of day with timezone information |
TIME ( Prec ) WITH TIME ZONE | time of day including fractions of a seconds with timezone information. Prec defines the number of fraction digits between 0 and 9 | |
TIMESTAMP | TIMESTAMP(0) | combination of date and time |
TIMESTAMP ( Prec ) | combination of date and time including fractions of a seconds. Prec defines the number of fraction digits between 0 and 9 | |
TIMESTAMP WITH TIME ZONE | TIMESTAMP(0) WITH TIMEZ ONE | timestamp with timezone information |
TIMESTAMP ( Prec ) WITH TIME ZONE | timestamp including fractions of a seconds with timezone information. Prec defines the number of fractions digit between 0 and 9 | |
INTERVAL interval_qualifier | a date/time/timestamp interval such as: INTERVAL DAY TO SECOND. See Temporal Types for all possible interval_qualifier values |
All scalar types include a NULL value, which is internally represented as a valid domain value. For numerical types, this is the smallest value in the type's domain (i.e., the one omitted in the ranges given above). Arithmetic expressions that overflow may lead to returning the NULL instead.
The integer types align with the storage of 1, 2, 4, 8 and 16 bytes.
The numeric and decimal types are represented as fixed length integers, whose decimal point is produced during result rendering.
The types REAL, FLOAT and DOUBLE map to the underlying implementation system.
No special attention is given to the value NaN.