Create table student
create table student(
sno int primary key,
sname varchar(20) not null,
sex int default 1
)
First, create an index
1. Create a non-clustered index
create index index_student_sno on student(sno)
2. Create a compound index
create index index_student_sno_sname on student(sno,sname)
3. Create a unique non-clustered index
create unique index index_student_sno on student(sno)
Second, delete the index
drop index student.index_student_sno
Third, update the index
1. Rename the index
--更改索引名: index_student_sno改为 index_student_sno1
sp_rename 'student.index_student_sno','index_student_sno1','INDEX'