In mysql, the difference and length between int, bigint, smallint, and tinyint are created by creating a table, let's take a look at the differences between int bigint smallint and tinyint in mysql and the length of www.2cto.com 1. CREATE the following TABLE 01 create table 'test _ int_1 '(02 'int _ id' int NOT NULL, 03 'bigint _ id' bigint default null, 04 'bigint _ 25' bigint (25) default null, 05 'bigint _ 18' bigint (18) default null, 06 'int _ 8' int (8) default null, 07 'int _ 3' int (3) default null, 08 'smallint _ id' smallint default null, 09 'ti Nyint_id 'tinyint default null, 10 primary key ('int _ id') 11) ENGINE = InnoDB default charset = utf82, desc 01 mysql> desc test_int_1; 02 + ------------- + ------ + ----- + --------- + ------- + 03 | Field | Type | Null | Key | Default | Extra | 04 + ------------- + ----------- + ------ + ----- + ----------- + ------- + 05 | int_id | int (11) | NO | PRI | NULL | 06 | bigint_id | bigint (20) | YES | NULL | 07 | bigint_25 | Bigint (25) | YES | NULL | 08 | bigint_18 | bigint (18) | YES | NULL | 09 | int_8 | int (8) | YES | NULL | 10 | int_3 | int (3) | YES | NULL | 11 | smallint_id | smallint (6) | YES | NULL | 12 | tinyint_id | tinyint (4) | YES | NULL | 13 + ------------- + ------ + ----- + --------- + ------- + 148 rows in set (0.00 sec) Comparison found that int bigint smallint and tinyint types, if M in int (M) is not specified when creating a new table, the default values are: Int ------- int (11) bigint ------- bigint (20) smallint ------- smallint (6) tinyint ------- tinyint (4) the following are the value ranges of these types. MySQL also supports specifying the display width of the integer (for example, INT (4) in parentheses after the type keyword )). Int (M) in integer data type, M indicates the maximum display width. This optional display width rule is used to fill the width from the left when the display width is smaller than the specified column width value. The display width does not limit the range of values that can be saved in the column, nor the display of values that exceed the specified width of the column. In int (M), the value of M has nothing to do with the storage space occupied by int (M. There is no relationship with the number of digits. int (3), int (4), and int (8) occupy the storage space of 4 btyes on the disk. When combined with the optional extension attribute ZEROFILL, the spaces supplemented by default are replaced by zero. For example, for a column declared as INT (5) ZEROFILL, value 4 is retrieved as 00004. Bigint is used in some special cases. When the integer value exceeds the range supported by the int data type, bigint can be used.