sql-server--索引

SQL Server****提供了五种索引类型,它们分别是
Ø 唯一索引
Ø 主键索引
Ø 聚集索引 ( Clustered Index )
Ø 非聚集索引 ( Nonclustered Index )
Ø 视图索引

sql 复制代码
--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表名

相关推荐
一只积极向上的小咸鱼1 小时前
第一性原理思考:从拆解问题到用实验检验答案
数据库
拂拉氏1 小时前
【知识讲解】 Linux之动静态库的了解
linux·运维·服务器·动静态库
这个DBA有点耶1 小时前
时序数据库InfluxDB高基数问题深度拆解:内存索引膨胀机制与OOM完整链路
数据库·架构·dba
Fcy6481 小时前
Linux下 五种IO模型的认识与⾮阻塞IO的实现
linux·服务器·io
加油yx2 小时前
MySQL数据类型
数据库·mysql
蓝胖的四次元口袋2 小时前
Redis知识梳理(1)
数据库·redis·缓存
夜雪一千2 小时前
MySQL 数据加密实战:从传输、存储到字段级加密,分清场景不踩坑
数据库·mysql
wefg13 小时前
【Redis】C++ 自定义客户端
数据库·redis·缓存
这个DBA有点耶3 小时前
为什么UPDATE比SELECT危险得多?锁范围等于扫描行数
数据库·架构·代码规范
天国梦3 小时前
国密门禁品牌怎么选?2026年最新3个避坑要点
运维·服务器·数据库·python