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表名

相关推荐
captain3765 小时前
MyBatis(入门5)其他查询操作
java·数据库·spring boot·mybatis
无足鸟ICT5 小时前
【RHCA+】vmstat命令(监控系统资源)
linux·服务器
垆边人似月.5 小时前
RDMA 文件传输踩坑(五):READY 发送成功后,为什么出现 Work Request Flushed Error?
服务器·网络·tcp/ip
闪亮的路灯5 小时前
Linux 安装mqtt服务mosquitto
linux·运维·服务器
HideF6 小时前
nmcli
linux·服务器·网络
小此方6 小时前
Re:Mysql数据库基础篇(八):详细讲解复合查询、多表查询、自连接、多行、多列子查询与合并查询
数据库·mysql
xszivvvv6 小时前
Mariadb数据库frm文件异常,如何恢复数据
数据库·mariadb
smile_life_6 小时前
MySQL 设置 防止账户被暴力破解
数据库·mysql
qetfw6 小时前
UOS DHCP Relay:跨网段分配与 IP、DNS、网关验证
linux·服务器·网络·tcp/ip·uos
ShineWinsu7 小时前
对于Qt:QRadioButton常见属性以及QButtonGroup的解析
数据库·c++·qt·microsoft·gui·qradiobutton·qbuttongroup