Home >Backend Development >PHP Tutorial >Please give me some advice on the length of Mysql field INT type, thank you!
Example: tinyint(1)
Note: What I understand is that the maximum positive number of the Tinyint type is 255. What I don’t understand is the purpose of setting 1 here. In fact, even if the length is set to 1, numbers larger than 1 digit can still be stored.
Doubt: If there is no need to pad with zeros, does this length limit still make sense? Or is it still necessary to set it up?
Example: tinyint(1)
Note: What I understand is that the maximum positive number of the Tinyint type is 255. What I don’t understand is the purpose of setting 1 here. In fact, even if the length is set to 1, numbers larger than 1 digit can still be stored.
Doubt: If there is no need to pad with zeros, does this length limit still make sense? Or is it still necessary to set it up?
MySQL specifies width for integer types, such as int(11), which is meaningless for most applications: it does not limit the legal range of values, but only specifies some interactive tools for MySQL (such as the MySQL command line client) Used to display the number of characters. For storage and calculation purposes, INT(1) and int(20) are the same.