当前位置:网站首页>Sql Server sql语句创建索引
Sql Server sql语句创建索引
2022-06-10 02:41:00 【执着的涛】
create index [index_mode] on [cn_name]([car_mode]);index_mode自定义索引名
cn_name表名
car_mode列名
1.创建普通索引
SQL CREATE INDEX 语法
在表上创建一个简单的索引。允许使用重复的值:
CREATE INDEX index_name
ON table_name (column_name);
注释:“column_name” 规定需要索引的列。
2.创建唯一索引
SQL CREATE UNIQUE INDEX 语法
在表上创建一个唯一的索引。唯一的索引意味着两个行不能拥有相同的索引值。
CREATE UNIQUE INDEX index_name
ON table_name (column_name);3.实例
CREATE INDEX 实例
本例会创建一个简单的索引,名为 “PersonIndex”,在 Person 表的 LastName 列:
CREATE INDEX PersonIndex
ON Person (LastName);4.索引添加约束
如果您希望以降序索引某个列中的值,您可以在列名称之后添加保留字 DESC:
CREATE INDEX PersonIndex
ON Person (LastName DESC);5.组合索引
假如您希望索引不止一个列,您可以在括号中列出这些列的名称,用逗号隔开:
CREATE INDEX PersonIndex
ON Person (LastName, FirstName);边栏推荐
- Latex doesn't break lines. Strange
- Boundary problems of regular expressions.
- uni-app 移动端本地储存数据库sqlite,无存储限制
- Introduction to 51 single chip microcomputer stepping motor
- mysql 8.0.29 winx64. Graphic tutorial of zip installation and configuration method
- Apache POI 学习笔记 - Excel
- 力扣每日一题-第17天-349.两个数据的交集
- 2022年PMP考试的3A好考吗?秘籍奉上
- 第六章 半导体存储器【微机原理】
- Project practice of data caching using redis
猜你喜欢

Lm03 who told you that cross species must be arbitraged?

midway的使用教程

Low code analysis and inventory: two misunderstandings need to be avoided in the application of low code in the banking industry
mysql 8.0.29 winx64. Graphic tutorial of zip installation and configuration method

如何用Google Home音箱语音控制智汀家庭云设备?

Postgresql中如何终止正在执行的查询

MySql安装+测试连接+常用终端mysql命令(超详细)

OpenCL Memory优化

电源管理(STM32)
The process of manually installing redis extensions in yii2 framework
随机推荐
Catering e-procurement scheme: procurement cycle management, saving 30% of the cost
pixi. JS explosion effect
Using GDI to realize multi-channel video stream merging
新增收货地址【项目 商城】
Power management (STM32)
What should be paid attention to in the operation of official account retention?
Get the list of provinces and cities 【 project mall 】
Introduction to 51 single chip microcomputer infrared communication
新建文档 bug,也可能是卡死了
51單片機入門——紅外通信
10 common high-frequency business scenarios that trigger IO bottlenecks
2. Introduction to naturallanguageprocessing
力扣每日一题-第17天-349.两个数据的交集
^28js is single threaded
Double pointer | 977 Square of ordered array
Should a reliable and safe company open an account for US crude oil futures?
Chicken and rabbit in the same cage
电源管理(STM32)
获取省市区列表【项目 商城】
Internal resources of stm32