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

相关推荐
曲幽8 小时前
FastAPI + PostgreSQL 实战:从入门到不踩坑,一次讲透
python·sql·postgresql·fastapi·web·postgres·db·asyncpg
DolphinDB14 小时前
集成 Prometheus 与 DolphinDB 规则引擎,构建敏捷监控解决方案
数据库
IvorySQL14 小时前
PostgreSQL 技术日报 (3月10日)|IIoT 性能瓶颈与内核优化新讨论
数据库·postgresql·开源
DBA小马哥17 小时前
时序数据库是什么?能源行业国产化替换的入门必看
数据库·时序数据库
爱可生开源社区20 小时前
某马来西亚游戏公司如何从 SQL Server 迁移至 OceanBase?
数据库
小瓦码J码1 天前
PostgreSQL表名超长踩坑记
数据库·postgresql
yhyyht1 天前
InfluxDB入门记录(三)flux-dsl
数据库·后端
IvorySQL2 天前
PostgreSQL 技术日报 (3月9日)|EXPLAIN ANALYZE 计时优化与复制语法讨论
数据库·postgresql·开源
用户8307196840822 天前
Java 告别繁琐数据统计代码!MySQL 8 窗口函数真香
java·sql·mysql
stark张宇2 天前
MySQL 核心内幕:从索引原理、字段选型到日志机制与外键约束,一篇打通数据库任督二脉
数据库·mysql·架构