Integer Numbers

On this page

Data Type

Size

Size (Not Null)

Synonyms

Min Value

Max Value

BOOL* (see note below)

2 bytes

1 byte

BOOLEAN

-128

127

BIT (used to store bit values; described in full here)

9 bytes

8 bytes

TINYINT

2 bytes

1 byte

-128

127

SMALLINT

4 bytes

2 bytes

-32768

32767

MEDIUMINT

4 bytes

3 bytes

-8388608

8388607

INT

8 bytes

4 bytes

INTEGER

-2147483648

2147483647

BIGINT

12 bytes

8 bytes

-2 ** 63

(2 ** 63) - 1

Remarks

BOOL and BOOLEAN are synonymous with TINYINT. A value of 0 is considered FALSE, non-zero values are considered TRUE.

The format: INT(x) (for example, INT(5)) is used to specify display width and not the size of the integer. Display width is not directly used within SingleStore Helios but may be used by some clients.

An optional UNSIGNED argument is allowed for INTEGER data types. It doubles the positive range, but cannot hold negative numbers. See the following examples:

CREATE TABLE test (uid INT UNSIGNED, id INT);
INSERT INTO test SELECT 4294967295, 4294967295;
INSERT INTO test SELECT -2, -2;
SELECT * FROM test;
+------------+------------+
| uid        | id         |
+------------+------------+
| 4294967295 | 2147483647 |
|          0 |         -2 |
+------------+------------+
CREATE TABLE test2 (uid TINYINT UNSIGNED, id TINYINT);
INSERT INTO test2 SELECT 255, 255;
INSERT INTO test2 SELECT -2, -2;
SELECT * FROM test2;
+------+------+
| uid  | id   |
+------+------+
|  255 |  127 |
|    0 |   -2 |
+------+------+

Last modified: June 6, 2023

Was this article helpful?