在列中使用 zerofill,如果该列数据类型为 int(4),插入 1,显示 0001;如果插入 55555,显示也是 55555;插入负数显示为0000。因为MySQL自动增加UNSIGNED属性 UNSIGNED不能为负数,当插入负数时就显示0。

#注意:column 紧跟两个age
alter table mchopin change column age age int(11) unsigned zerofill;

更多推荐

MySQL 中的【ZEROFILL零填充】