开发者

mysql autoincrement whats the correct type?

开发者 https://www.devze.com 2023-02-01 20:36 出处:网络
I want to make an autoincrement primary index column when making a table. It must be an int (ie. able to get into the millions)

I want to make an autoincrement primary index column when making a table.

It must be an int (ie. able to get into the millions)

On the mysql manual page, it shows 2 different types of int, one that goes from -ve to +ve and one that goes from 0 to +ve. http://dev.mysql.com/d开发者_运维百科oc/refman/5.0/en/numeric-types.html

I want my autoincrement to start at 1 not -ve millions. For my new column then, which should I use? How do I make it choose the correct one?


For an ID, the unsigned type (0 ... MAX) is the one that makes sense. You are unlikely to want negative IDs.

0

精彩评论

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