直接学习:https://edu.csdn.net/course/play/27328/362533
复合索引前导列特性:
#1、在mysql中如果创建了复合索引(name,salary,dept),就相当于创建了(name,salary,dept),(name,salary),(name)三个索引,这被称为复合索引前导特性。
#2、示例代码如下:
show index from employee\G;
explain select * from employee where name= '柳锋'\G;
create index index_name_salary_dept on employee(name,salary,dept);
explain select * from employee where name= '柳锋'\G;
explain select * from employee where salary= 8800\G;
explain select * from employee where dept= '部门A'\G;
explain select * from employee where name= '柳锋'and salary=8800\G;
explain select * from employee where name= '柳锋'and dept='部门A'\G;