当前位置:网站首页>Database - index
Database - index
2022-06-27 05:44:00 【zhixingheyi_ tian】
Create index
Indexes are created in existing tables , It makes the positioning of rows faster and more efficient . You can create indexes on one or more columns of a table , Each index will be named . The user cannot see the index , They can only be used to speed up queries .
notes : Updating a table with an index takes more time than updating a table without an index , This is because the index itself needs to be updated . therefore , It is ideal to create an index only on the columns that are often used for searching .
Unique index (Unique Index)
Create a unique index on the table . A unique index means that two rows cannot have the same index value .
CREATE UNIQUE INDEX The index name
ON The name of the table ( Column name )
“ Column name ” Specify the columns you want to index .
Indexes
Simple index
Create a simple index on the table . When we omit keywords UNIQUE when , You can use duplicate values .
CREATE INDEX The index name
ON The name of the table ( Column name )
“ Column name ” Specify the columns you want to index .
example
This example creates a simple index , be known as “PersonIndex”, stay Person Tabular LastName Field :
CREATE INDEX PersonIndex
ON Person (LastName)
If you want to index the values in a column in descending order , You can add a reserved word after the column name DESC:
CREATE INDEX PersonIndex
ON Person (LastName DESC)
If you want to index more than one column , You can list the names of these columns in parentheses , Separated by commas :
CREATE INDEX PersonIndex
ON Person (LastName, FirstName)
边栏推荐
- Netease cloud music params and encseckey parameter generation code
- 论文解读(LG2AR)《Learning Graph Augmentations to Learn Graph Representations》
- Spark 之 WholeStageCodegen
- The most detailed download tutorial of MySQL
- [cocos creator 3.5.1] addition of coordinates
- neo4j图数据库基本概念
- 【Cocos Creator 3.5.1】input. Use of on
- Using domain name forwarding mqtt protocol, pit avoidance Guide
- 齐纳二极管 稳压二极管 SOD123封装 正负区分
- 【FPGA】UART串口_V1.1
猜你喜欢
随机推荐
pycharm 如何安装 package
Opencv implements object tracking
Wechat applet websocket use case
How pychart installs packages
STM32 MCU pin_ How to configure the pin of single chip microcomputer as pull-up input
IP网络通信的单播、组播和广播
What is BFC? What's the usage?
机械转码日记【17】模板,STL简介
Experience oceanbase database under win10
leetcode298周赛记录
Edge loads web pages in IE mode - edge sets ie compatibility
Execution rules of pytest framework
【Cocos Creator 3.5.1】input.on的使用
[FPGA] realize the data output of checkerboard horizontal and vertical gray scale diagram based on bt1120 timing design
Pytest框架的执行规则
Implementation of easyexcel's function of merging cells with the same content and dynamic title
Unity中跨平臺獲取系統音量
数据库-索引
Two position relay rxmvb2 r251 204 110dc
Leetcode298 weekly race record









