Integer Types
Numeric types consist of one, two, four, and eight-byte integers.
Data Type | Size | Size (Not Null) | Synonyms | Min Value | Max Value |
---|---|---|---|---|---|
TINYINT | 2 bytes | 1 byte | INT8 | -128 | 127 |
UNSIGNED TINYINT | 2 bytes | 1 byte | UINT8 | 0 | 255 |
SMALLINT | 3 bytes | 2 bytes | INT16 | -32768 | 32767 |
UNSIGNED SMALLINT | 3 bytes | 2 bytes | UINT16 | 0 | 65535 |
INTEGER | 5 bytes | 4 bytes | INT, INT32 | -2147483648 | 2147483647 |
UNSIGNED INTEGER | 5 bytes | 4 bytes | UINT32 | 0 | 4294967295 |
BIGINT | 9 bytes | 8 bytes | INT64 | -263 | (263) - 1 |
UNSIGNED BIGINT | 9 bytes | 8 bytes | UINT64 | 0 | (264) - 1 |
The 'size' above represents the in-memory size of the column. The on-disk storage of integer types always use a compressed format based on the value of the column being stored. This means that a 64 bit integer column with a value of '1' and a 8 bit integer column with a value of '1' will occupy the same amount of disk space.
The types TINYINT, SMALLINT, INTEGER (or INT), and BIGINT store whole numbers, that is, numbers without fractional components, of various ranges. Attempts to store values outside of the allowed range will result in a "value out of range" error.
These types are, by default, unsigned integers. Adding the UNSIGNED directive before the type will create an unsigned integer column.
To declare an integer type column, use the following syntax:
INTEGER
defines a 32 bit signed integer column. And,
UNSIGNED SMALLINT
defines a 16 bit unsigned integer column.
Numeric types can be included in an ARRAY. See Arrays.
See Also