# Integer Data Types
+ Data Types:
  + **`TINYINT`**
  + **`SMALLINT`**
  + **`MEDIUMINT`**
  + **`INT`**, **`INTEGER`**
  + **`BIGINT`**
+ Attributes:
  + **`UNSIGNED`**: Negative numbers are not allowed

| Type        | Storage | 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 |

------------------------------------------------------------
TiDB supports all integer types in MySQL, including INTEGER/INT, TINYINT, SMALLINT, MEDIUMINT, and BIGINT

Notes: TiDB supports an extension for optionally specifying the display width of integer data types in parentheses following the base keyword for the type. For example, INT(7) specifies an INT with a display width of 7 digits. This optional display width may be used by applications to display integer values having a width less than the width specified for the column by left-padding them with spaces. The display width does not constrain the range of values that can be stored in the column. Nor does it prevent values wider than the column display width from being displayed correctly.

- TINYINT type. The range for signed numbers is [-128, 127]. The range for unsigned numbers is [0, 255].
  - `TINYINT[(M)] [UNSIGNED] [ZEROFILL]` 

- Smallint type. The range for signed numbers is [-32768, 32767]. The range of unsigned numbers is [0, 65535]
  - `SMALLINT[(M)] [UNSIGNED] [ZEROFILL]` 

- MEDIUMINT type. The range for signed numbers is [-8388608, 8388607]. The range for unsigned numbers is [0, 16777215].
  - `MEDIUMINT[(M)] [UNSIGNED] [ZEROFILL]` 

- INTEGER type, alias INT. The range of signed numbers is [-2147483648, 2147483647]. The range for unsigned numbers is [0, 4294967295].
  - `INT[(M)] [UNSIGNED] [ZEROFILL] or INTEGER[(M)] [UNSIGNED] [ZEROFILL]` 

- BIGINT type. The range of signed numbers is [-9223372036854775808, 9223372036854775807]. The range for unsigned numbers is [0, 18446744073709551615].
  - `BIGINT[(M)] [UNSIGNED] [ZEROFILL]` 


