通过show create table 查看结果如下:
发现‘id’字段并非主键,现在需要把其设置为主键且自增,语句如下:
alter table xun1 drop id;
alter table xun1 add id int(6) not null primary key auto_increment first;
其中 first 是把该字段放到第一个字段的意思。结果如下:
通过show create table 查看结果如下:
发现‘id’字段并非主键,现在需要把其设置为主键且自增,语句如下:
alter table xun1 drop id;
alter table xun1 add id int(6) not null primary key auto_increment first;
其中 first 是把该字段放到第一个字段的意思。结果如下: