The width specification is most often used with zerofill
mysql>
mysql> CREATE TABLE test4(id INT(3) ZEROFILL,id2 INT ZEROFILL);
Query OK, 0 rows affected (0.01 sec)
mysql>
mysql> INSERT INTO test4(id,id2) VALUES (22,22);
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> SELECT * FROM test4;
+------+------------+
| id | id2 |
+------+------------+
| 022 | 0000000022 |
+------+------------+
1 row in set (0.00 sec)
mysql>
mysql>
mysql> drop table test4;
Query OK, 0 rows affected (0.00 sec)
Related examples in the same category