索引的创建和删除

创建索引

索引可以在创建表时同时创建,也可以随时增加新的索引。

#创建新索引
create [unique|fulltext|spatial] index 索引名称 [using index_type] on 表名(要添加索引的列名);
#添加主键索引
alter table 表名 add primary key (列名);
#添加唯一索引
alter table 表名 add unique (列名);
#添加普通索引
alter table 表名 add index 索引名称 (列名);
#添加全文索引
alter table 表名 add fulltext(列名);
#添加多列索引
alter table 表名 add index 索引名称( 列1, 列2, 列3);

删除索引

drop index 索引名称 on 表名;
原文地址:https://www.cnblogs.com/drake-guo/p/6231598.html