当前位置:网站首页>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开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- MySQL的主从复制
- 使用MULTISET来比较数据集的实例介绍
- Brush questions record----string
- 网络安全实验环境搭建
- MySQL——几种常见的嵌套查询
- HarmonyOS笔记-----------(三)
- Recommendation System - Sorting Layer: Sorting Layer Architecture [User and Item Feature Processing Steps]
- [PM only] Quickly count who else in the team has not registered and reported information, and quickly screen out the members of their own project team who have not completed the list of XXX work items
- PPT如何开启演讲者模式?PPT开启演讲者模式的方法
- To the operation of the int variable assignment is atom?
猜你喜欢
Ordinary int main(){} does not write return 0; what will happen?
推荐系统:实时性【特征实时性:客户端实时特征(秒级,实时)、流处理平台(分钟级,近实时)、分布式批处理平台(小时/天级,非实时)】【模型实时性:在线学习、增量更新、全量更新】
MySQL的on duplicate key update 的使用
MySQL_关于JSON数据的查询
These services can't ali interview?Then don't go to, the basic notification, etc
flyway的快速入门教程
MySQL database --- Addition, deletion, modification and query of MySQL tables (advanced)
推荐系统-排序层:排序层架构【用户、物品特征处理步骤】
第04章 逻辑架构【1.MySQL架构篇】【MySQL高级】
Mysql——字符串函数
随机推荐
明解C语言第六章习题
Difference Between Concurrency and Parallelism
These services can't ali interview?Then don't go to, the basic notification, etc
WPS怎么独立窗口显示?wps单独窗口显示怎么操作?
MySQL的on duplicate key update 的使用
GateWay实现负载均衡
KEIL问题:【keil Error: failed to execute ‘C:\Keil\ARM\ARMCC‘】
【回归预测-lssvm分类】基于最小二乘支持向量机lssvm实现数据分类代码
普通的int main(){}没有写return 0;会怎么样?
基于人脸的常见表情识别——模型搭建、训练与测试
我是一名阿里在职9年软件测试工程师,我的经历也许能帮到处于迷茫期的你
After MySQL grouping, take the largest piece of data [optimal solution]
ECCV2022 | 对比视觉Transformer的在线持续学习
flyway的快速入门教程
CDH集群spark-shell执行过程分析
第04章 逻辑架构【1.MySQL架构篇】【MySQL高级】
MySQL (2)
【请教】SQL语句按列1去重来计算列2之和?
Apple Silicon配置二进制环境(一)
6.3有定型性 第七章