MySQL创建和删除索引
创建普通索引:
alter table student add index index_dept(dept(8));
创建唯一索引
create unique index uni_ind_name on student (name);
根据列的前n个字符创建索引
create index index_dept on student(dept(8));
根据多个列创建联合索引
create index ind_name_dept on student(name,dept);
根据多个列的前n个字符创建联合索引
create index ind_name_dept on student (name(8), dept(10));
删除普通索引
alter table student drop index index_dept;
drop index index_dept on student;