Mysql integer data width, field zero fill and symbol _ MySQL
Source: Internet
Author: User
Mysql integer data width, zero field filling and symbol bitsCN.com
Mysql integer data width, zero field filling and symbol 1. in mysql, the integer type is signed or unsigned. of course, the integer type is also used. you can use age tinyint unsigned when defining a field, unsigned indicates that it is unsigned, that is, it is a large number or equal to 0. if this is used, it is the default signed age tinyint, 2. the following statement uses integer data width and zero padding: age tinyint (1), which indicates that the age field is 1 character width. However, if the zero padding is not set, mysql ignores the character width. The following statement has a valid age tinyint (1) zerofill. The data width is valid only after zero padding is set. if the inserted data is 20, an error is inserted. Note: zerofill fields are unsigned by default, that is, data greater than or equal to zero. if the input is a small value or zero number, an error is returned. This statement is the same as the previous statement: age tinyint (1) unsigned zerofill. another note is that it is best to set the default value for the field. Otherwise, it is difficult to compare it with anyone who can compare it when the field value in mysql is null, it cannot even be compared with null itself. the comparison result is null. Author com360bitsCN.com
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.