索引的建立和删除

建立索引spa

索引能够在建立表时同时建立,也能够随时增长新的索引。code

#建立新索引
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);

 

删除索引blog

drop index 索引名称 on 表名;
相关文章
相关标签/搜索