创建mysql索引的方式

创建索引方式:

1、create index 索引名   on 表名 (字段)

2、alter table 表  add index 索引名  (字段)

-- 普通索引
alter table 表名 add index 索引名 (字段) ;
-- 唯一索引
alter table 表名 add unique (字段) ;
-- 主键索引
alter table 表名 add primary key (字段) ;

删除索引:

drop index 索引名  on 表名

猜你喜欢

转载自www.cnblogs.com/tanzhijian136/p/12064388.html