当前位置:网站首页>MySql 创建索引
MySql 创建索引
2022-07-30 20:15:00 【m0_66557301】
– (1)自动创建索引
– 创建表index_book并为其添加索引(创建主键和唯一约束)
create table index_book(
id int(8) primary key auto_increment,
name varchar(20),
price float(3),
date varchar(20)
)
# 查看index_book中的索引
– 语法: show index from 表名
show index from index_book
– (2)手动创建索引
# 创建表index_book1给id添加索引
create table index_book1(
id int(8) ,
name varchar(20),
price float(3),
date varchar(20),
index(id)
)
# 创建表index_book2给sname添加唯一索引
create table index_book2(
id int(8) ,
sname varchar(20),
price float(3),
date varchar(20),
unique index(sname)
)
– (3)主键创建索引
# 创建表index_book3给id添加主键索引
create table index_book3(
id int(8) ,
sname varchar(20),
price float(3),
date varchar(20),
primary key (id)
)
– (4)全文创建索引
#创建表index_book4给info添加索引
create table index_book4(
id int(8) ,
sname varchar(20),
price float(3),
date varchar(20),
info varchar(200),
fulltext index(info)
)
– (5)空间索引的创建
– 注: 空间类型数据添加值不能为空 not null
#创建表index_book5给sook字段类型为point添加索引
create table index_book5(
id int(8) ,
sname varchar(20),
price float(3),
date varchar(20),
sook point not null,
spatial index(sook)
)
– (6)复合索引的创建
#创建表index_book6给id和date添加复合索引
create table index_book6(
id int(8) ,
sname varchar(20),
price float(3),
date varchar(20),
index(id,date)
)
先自我介绍一下,小编13年上师交大毕业,曾经在小公司待过,去过华为OPPO等大厂,18年进入阿里,直到现在。深知大多数初中级java工程师,想要升技能,往往是需要自己摸索成长或是报班学习,但对于培训机构动则近万元的学费,着实压力不小。自己不成体系的自学效率很低又漫长,而且容易碰到天花板技术停止不前。因此我收集了一份《java开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- 网络安全实验环境搭建
- Interviewer Ali: Describe to me the phenomenon of cache breakdown, and talk about your solution?
- 【无标题】多集嵌套集合使不再有MultipleBagFetchException
- MySQL的 DDL和DML和DQL的基本语法
- 【Codeforces思维题】20220728
- [NISACTF 2022]下
- ERROR 1045 (28000) Access denied for user 'root'@'localhost'Solution
- SQLyog注释 添加 撤销 快捷键
- jOOQ是如何设计事务API(详细指南)
- vookloop函数怎么用?vlookup函数的使用方法介绍
猜你喜欢
随机推荐
[NISACTF 2022]下
Weak Banks to data conversion ability?Matt software help solve bank dilemma
[Ask] SQL statement to calculate the sum of column 2 by deduplicating column 1?
基于人脸的常见表情识别(1)——深度学习基础知识
Maxwell 一款简单易上手的实时抓取Mysql数据的软件
[Node implements data encryption]
Face-based Common Expression Recognition (2) - Data Acquisition and Arrangement
idea plugins搜索不到插件
Mysql——字符串函数
服务器不稳定因素
Recommended system: cold start problem [user cold start, item cold start, system cold start]
ECCV2022 | 对比视觉Transformer的在线持续学习
Difference Between Concurrency and Parallelism
FFmpeg —— 裁剪视频(含音视频),不需编解码(附完整源码)
YOLO V3详解
How to copy table structure and table data in MySQL
6.3有定型性 第七章
MySQL six-pulse sword, SQL customs clearance summary
Recommender systems: overview of the characteristics of architecture: user/item engineering -- -- -- -- -- -- -- -- > recall layer > sort layer - > test/evaluation 】 【 cold start problems, real-time 】
网络层协议------IP协议