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

相关推荐
Cosolar2 小时前
LlamaIndex索引类型全解析:原理与实战指南
运维·服务器
睡不醒男孩0308234 小时前
第二篇:深入探索开源数据库高可用:构建基于CLup的PostgreSQL生产级高可用与读写分离架构
数据库·postgresql·开源·clup
方便面不加香菜5 小时前
Linux--基础IO(一)
linux·运维·服务器
Micro麦可乐6 小时前
Spring Boot 实战:从零设计一个短链系统(含完整代码与数据库设计)
数据库·spring boot·后端·哈希算法·雪花算法·短链系统
码农阿豪7 小时前
从零到一:Spring Boot快速接入金仓数据库实战
数据库·spring boot·后端
鼎讯信通7 小时前
风电光缆运维提质增效:G-4000A 光缆故障追踪仪破解风场巡检难题
运维·网络·数据库
三十..7 小时前
MySQL 从入门到高可用架构实战精要
运维·数据库·mysql
cfm_29148 小时前
Redis五大基本数据结构底层了解
数据结构·数据库·redis
真实的菜9 小时前
Redis 从入门到精通(十二):典型业务场景实战 —— 排行榜、限流器、秒杀系统、Session 共享
数据库·redis·python
你想考研啊9 小时前
mysql数据库导出导入
数据库·mysql·oracle