开发者

mySQL field type question

I have db table cell that stores 5-digit zip code, however when the zip starts with 0 it is dropped and only 4 digits are stored. Currently the column 开发者_如何学运维type is set to INT(5), but clearly this is not working.

What type shall I use instead?

Thanks.


Try using a CHAR(5) data type if it's always going to 5 digits long


Try using int(5) zero fill. Then you get the speed of an int but the zero at the front. I recently had this issue and solved it this way.


CHAR(5) CHARACTER SET ascii COLLATE ascii_bin

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜