Tinyint data type in mysql
The mysql database defines the data type as "data type (m:
Here, the number m represents different meanings in different data types.
The integer system has limited the value range. For example, tinyint occupies one byte (8 bit) and int occupies four bytes.
Therefore, m after an integer is not the length of the data, but the minimum length of the data displayed (the length is the number of characters ).
Tinyint (1) here 1 indicates the minimum display width is 1 character.
Tinyint (2) here 2 represents the minimum display width is 2 characters, but here setting m is meaningless, you also need to specify what to fill with when the data is smaller than the length of m, such as zerofill (indicating that there is 0 filling ).
Set tinyint (2) zerofill. When you insert 1, it will display 01.
Set tinyint (4) zerofill. When you insert 1, it will display 0001.