MySQL的auto_increment属性只能用在主键上吗?
MySQL的auto_increment属性只能用在主键上吗? |
免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。
版权声明:作者保留权利,不代表天盟立场。
|
|
|
|
1、被auto_increment修饰的列为标识列,可以自动增长。一张表中只能有一个标识列。
2、auto_increment只能用来修饰数值类型的列,并且该类型的列列只能为key类型的列,key类型的列有:primary key 、unique、key、foreign key |
|
|
|
|
The AUTO_INCREMENT attribute can be used to generate a unique identity for new rows:
The primary key for a table represents the column or set of columns that you use in your most vital queries
|
|
|
|
|
GSOIIUUUGOR
BNZJCZEHROB
JFYHRZIIQYU
SILJMMRPYIB
ZJCKXKIHRRB
MDWPMZENROL
ZFGZWFSXQHR
FLUUKKYEHMG
KWYIIJJWGJA
DTGQDOMMWDC
VCYYILHLNEX
PYRRXHCBVOY
GSOIJJUFVZI
HWMMPDUDVJT
HKDMXAOZJJC
GWYRHSFOIPW
VVOOBEHEESC
HORSEYKEUUH
LOIHEKAXHHT
CLKNHFWTTWF
UOJWWWTMJXQ
UAZGEYOYOHE
MZIBVYXEUEO
BTAKUXZCGMP
HWWPJTJMMSC
VRTNKUHJDDW
KGISQZGSJCQ
VSIVYCLBVVI
QCFSLLBZSMF
IELOKVBLEYU
AMPFFVREYIL
MIHMGTZXXKY
FBINJKDYHEO
XACGTUUHHEP
TKWHHHHNHEB
HXGWCMFSCFZ
WFLVIIXFOIV
WSUIPFPLFPY
BXDWZPOLEYB
FHHKXKTZVHE
BDQDZJJTWGD
OUTDJSVPIMW
OIGQDDKATAG
CACPWPSMQJA
TIVOYYURKUH
JFZZJGJXQAK
KPZZLFYSCMT
KGZJVMVGPZT
JIVTQAXKUYR
XVWKBLVRYIO
WZPTWWBLVSJ
RKDWTCWUUOX
AQQTOVUCSPZ
YEUUNQANDWQ
QWSSVWJCMSM
FBBESBIBUEY
PLXJIPUFYMM
VBRGGWFLPCK
ZFWCPVOVFPF
VRUANNHOEBR
IIOHRAXUNQD
VVPSIMSYANH
TSMUNHJJWGZ
YYHREXQAUAU
JKKAYYVFBLS
CSVZMWQQANN
NJTGJTADNYI
AWYCOWGDAGG
TFOHYVFNRKX
KQQIIBQANXN
UJTZUECLFSL
ZOXJMCZZSVP
IHNHNGDWJJQ
UJZSVJNNGAD
KAHHVEVLEOB
FVYIEPSICPI
YLNFCZJJCMM
YHBERCVLLLV
EYOKHAYZPFY
JYUYBSFFJMW |
|
|
|
|
there can be only one auto column and it must be defined as a key. |
|
|
|
|
并不是,主键可以没有auto_increment属性,但是一张表只能有一个auto_increment属性。 |
|
|
|
|