5.2.1. Integer Data Types
Integer data types include TINYINT, SMALLINT, MEDIUMINT, INT, and BIGINT. Smaller integer types require less storage space, but are more limited in the range of values they represent. For example, TINYINT column values take only one byte each to store, but the type has a small range (–128 to 127). INT column values require four bytes each, but the type has a much larger range (–2,147,483,648 to 2,147,483,647). The integer data types are summarized in the following table, which indicates the amount of storage per value that each type requires as well as its range. For integer values declared with the UNSIGNED attribute, negative values are not allowed, and the high end of the range shifts upward to approximately double the maximum positive value of the signed range.
Type
Storage Required
Signed Range
Unsigned Range
TINYINT
1 byte
–128 to 127
0 to 255
SMALLINT
2 bytes
–32,768 to 32,767
0 to 65,535
MEDIUMINT
3 bytes
–8,388,608 to 8,388,607
0 to 16,777,215
INT
4 bytes
–2,147,683,648 to 2,147,483,647
0 to 4,294,967,295
BIGINT
8 bytes
–9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
0 to 18,446,744,073, 709,551,615
Integer data types may be declared with a display width, which affects the number of digits used to display column values in query output. For example, assume that you declare an INT column with a display width of 4 like this: [omissis]