INT
Complete INT type reference: INT(M) syntax, signed (-2147483648 to 2147483647) vs unsigned (0 to 4294967295) ranges, and ZEROFILL padding guidelines.
Syntax
INT[(M)] [SIGNED | UNSIGNED | ZEROFILL]
INTEGER[(M)] [SIGNED | UNSIGNED | ZEROFILL]Description
Examples
With strict_mode set
CREATE TABLE ints (a INT,b INT UNSIGNED,c INT ZEROFILL);INSERT INTO ints VALUES (-10,-10,-10);
ERROR 1264 (22003): Out of range value for column 'b' at row 1
INSERT INTO ints VALUES (-10,10,-10);
ERROR 1264 (22003): Out of range value for column 'c' at row 1
INSERT INTO ints VALUES (-10,10,10);
INSERT INTO ints VALUES (2147483648,2147483648,2147483648);
ERROR 1264 (22003): Out of range value for column 'a' at row 1
INSERT INTO ints VALUES (2147483647,2147483648,2147483648);
SELECT * FROM ints;
+------------+------------+------------+
| a | b | c |
+------------+------------+------------+
| -10 | 10 | 0000000010 |
| 2147483647 | 2147483648 | 2147483648 |
+------------+------------+------------+SIGNED and UNSIGNED
Out-of-Range
INT ZEROFILL
See Also
Last updated
Was this helpful?

