mysql:there can be only one auto column...
一,问题发生今天(18/1/18),我在尝试删除一个定义为auto_increment的主键时(所用语句:alter table testdrop primary key)结果报了如下错误。Incorrect table definition; there can be only one auto column and it must be defined as a key
·
一,问题发生
今天(18/1/18),我在尝试删除一个定义为auto_increment的主键时(所用语句:alter table test
drop primary key)结果报了如下错误。
Incorrect table definition; there can be only one auto column and it must be defined as a key
翻译:错误的表定义,一个表只能有一个自增列并且该列必须是主键。
二,实验
自增的列必须是主键
如图:我定义了一个自增,没有定义主键,报错。
修改为主键后成功。
三 最终结论
自增的属性列必须是主键
补充:自增的属性列必须定义为数值(int等)类型。
更多推荐
已为社区贡献3条内容
所有评论(0)