– 创建单列索引
use mydb1;
create table student(
sid int primary key,
card_id varchar(20),
name varchar(20),
gender varchar(20),
age int,
birth varchar(20),
phone_num varchar(20),
score double,
index index_name(name) – 给Name列创建索引
);
– 2.直接创建
create index index_gender on student(gender);
– 3 查询方式
– select * from student where name=‘张三’;
– 4.修改表结构(添加索引)
alter table student add index index_age(age);
– 删除索引
drop index index_gender on student;
alter table student drop index index_age;
– 查询索引
show index from student;