MySQL 添加序号列

在表abc中添加一个自动添加的序号列num表abc已存在!!!
2025-12-13 21:38:47
推荐回答(2个)
回答1:

alter table abc add num int unsigned auto_increment
如果同时为主键的话,可以这样写
alter table abc add num int unsigned primary key auto_increment
__________________________________________
to:数据库强者 不ok

回答2:

可以证明你的那个库里面存在abc表

请先执行

drop table abc

然后再运行

create table abc
(
num int primary key not null identity(1,1)
)

ok!!

to :mxm_1123

嘿嘿
有问题请告之!