建自增列 必须是主键列,先建主键,才能建自增列
1.
create table t_payment(
id int not null comment 'ID',
com_id numeric not null comment '公司ID',
);
alter table t_payment
add primary key (id);
alter table t_payment modify id int auto_increment;
2.
create table t_payment
(
id int not null auto_increment comment 'ID',
com_id numeric not null comment '公司ID',
primary key(id)
);