Home > Article > Daily Programming > What are the unsigned constraint keywords in mysql?
The keywords used to specify unsigned constraints in MySQL are: UNSIGNED: allows positive values and zero. UNSIGNED ZEROFILL: Positive values and zeros are allowed, and all values are left-padded with zeros to match the column length.
Unsigned constraint keyword in MySQL
Unsigned constraint is used to limit the column to only contain non-negative values value. The keywords used to specify unsigned constraints in MySQL are:
UNSIGNED
Meaning: Allow positive values and zeros
Syntax: Column name UNSIGNED
For example: id INT UNSIGNED
UNSIGNED ZEROFILL
Meaning: Positive values and zero are allowed, and All values are left padded with zeros to match the column length
Syntax: Column name UNSIGNED ZEROFILL
Example: account_number BIGINT UNSIGNED ZEROFILL
Usage scenarios
Unsigned constraints are usually used to store non-negative values, such as:
Advantages
Note
UNSIGNED ZEROFILL
Constraint only applies to integer typesThe above is the detailed content of What are the unsigned constraint keywords in mysql?. For more information, please follow other related articles on the PHP Chinese website!