The width specification is most often used with zerofill : Int « Data Type « SQL / MySQL






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

1.Int(11) not null
2.Default null value for Int type column
3.INTEGER(4) ZEROFILL
4.Compare with integers
5.INT UNSIGNED
6.How MySQL deals with non-exist number