SQL Server提供了五种索引类型,它们分别是
Ø
唯一索引
Ø
主键索引
Ø
聚集索引
(
Clustered Index
)
Ø
非聚集索引
(
Nonclustered Index
)
Ø
视图索引
--tb_student表的sno列创建索引
create index ix_sno on tb_student(sno)
--在tb_student表中的sex和birthday列创建组合索引
create index ix_sex on tb_student(sex,birthday)
--在tb_student表中的sn列创建唯一索引。
create unique index ix_xm
on tb_student(sn)
--测试唯一索引
select * from tb_student
where sn=‘曲筱绡'
insert into tb_student (sno, sn,sex)
values (‘1422170’,‘曲筱绡’,‘女')
删除索引
¯
使用
drop index
语句删除索引
drop index <表名.索引名称>
或 drop index 索引名称 on 表名