创建表格student
create table student(
sno int primary key,
sname varchar(20) not null,
sex int default 1
)
一、创建索引
1、创建非聚集索引
create index index_student_sno on student(sno)
2、创建复合索引
create index index_student_sno_sname on student(sno,sname)
3、创建唯一非聚集索引
create unique index index_student_sno on student(sno)
二、删除索引
drop index student.index_student_sno
三、更新索引
1、重命名索引
--更改索引名: index_student_sno改为 index_student_sno1
sp_rename 'student.index_student_sno','index_student_sno1','INDEX'