After the 1.MySQL field specifies the type, the storage is fixed-length, and the Int (1) and int (4) are the same from their own lengths or stored methods. In MySQL, the difference between int (1) and int (4) is the length of the display, but to set a parameter: If the column has a zerofill, it will be displayed with 0 padding, such as 2 int (3), which will be displayed as 002.
2.int storage accounts for 4 bytes, tinyint storage accounts for 1 bytes, and the storage length determines the range of numbers they represent. The range of numbers represented by int is: integer data (all numbers) from -2^31 (-2,147,483,648) to 2^31–1 (2,147,483,647). The range represented by tinyint is a number between 0-255.
3.tinyint (1), and tinyint (3) No difference, save 123 can be saved, and if tinyint (3) Zerofill, insert value 12, will be stored 012,zerofill auto left 0, this is the limit display length.
I understand the limit display length as tinyint (1) 123 should have only one of the numbers.
Here is a concise summary:
tinyint (1) and tinyint (3) are no different, taking up bytes is a single, storage range is the same.
tinyint (3) Zerofill, when the data inserted less than 3 bits, the left automatically 0, this is the limit display length AH.
Int (1) and tinyint (1), if sufficient, preference is given to tinyint (1), since the footprint is small and space-saving.
tinyint a byte smallint two bytes mediumint three bytes int 4 bytes BIGINT 8 bytes.
However, varchar (5) Here the 5 limit is the number of characters stored, the characters are not divided into Chinese, English, digital ... )。
Summary data from the network ...