MySQL添加/删除主键、外键、唯一键、索引、自增
转: 思想永无止境
主键
主键会自动添加唯一索引,所以主键列不需要添加索引
建表时设置主键
create table tableName(
id int primary key
);
或:
create table tableName(
id int,
primary key (id)
);
单独设置主键
alter table tableName add primary ...
转载
2019-03-07 10:33:29 ·
1042 阅读 ·
0 评论