当前位置:网站首页>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开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- Linux download and install mysql5.7 version tutorial the most complete and detailed explanation
- 推荐系统-排序层:排序层架构【用户、物品特征处理步骤】
- 【考研词汇训练营】Day18 —— amount,max,consider,account,actual,eliminate,letter,significant,embarrass,collapse
- Recommendation System - Sorting Layer: Sorting Layer Architecture [User and Item Feature Processing Steps]
- 从离线到实时对客,湖仓一体释放全量数据价值
- Recommender systems: overview of the characteristics of architecture: user/item engineering -- -- -- -- -- -- -- -- > recall layer > sort layer - > test/evaluation 】 【 cold start problems, real-time 】
- Running the evict task with compensationTime
- Typora设置标题自动标号
- KEIL问题:【keil Error: failed to execute ‘C:\Keil\ARM\ARMCC‘】
- MySQL eight-part text recitation version
猜你喜欢
MySQL six-pulse sword, SQL customs clearance summary
历史上的今天:Win10 七周年;微软和雅虎的搜索协议;微软发行 NT 4.0
如何解决gedit 深色模式下高亮文本不可见?
Recommendation system: evaluation index [offline evaluation index: RMSE (root mean square error), AUC, precision, recall, F1] [online evaluation: A/B test] [generally required response time <0.5s]
【PM专用】快速统计团队还有谁没有登记上报信息,快速筛选出属于自己项目组的成员,未完成XXX工作事项的名单
MySQL的DATE_FORMAT()函数将Date转为字符串
[Node implements data encryption]
idea plugins搜索不到插件
推荐系统:AB测试(AB Test)
Linux download and install mysql5.7 version tutorial the most complete and detailed explanation
随机推荐
对int变量赋值的操作是原子的吗?
Database Tuning - Database Tuning
vlookup函数匹配不出来的原因及解决方法
Zabbix部署与练习
Face-based Common Expression Recognition (2) - Data Acquisition and Arrangement
Flink_CDC搭建及简单使用
FFmpeg —— 将mp4转为gif输出(附源码)
移动web开发01
SQLyog注释 添加 撤销 快捷键
Based on the face of the common expression recognition - model building, training and testing
HMS Core音频编辑服务音源分离与空间音频渲染,助力快速进入3D音频的世界
我是一名阿里在职9年软件测试工程师,我的经历也许能帮到处于迷茫期的你
MySQL数据库字段超长问题
OSS simply upload pictures
PPT如何开启演讲者模式?PPT开启演讲者模式的方法
Brush questions record----string
推荐系统:实时性【特征实时性:客户端实时特征(秒级,实时)、流处理平台(分钟级,近实时)、分布式批处理平台(小时/天级,非实时)】【模型实时性:在线学习、增量更新、全量更新】
多线程获取官方汇率
推荐系统-排序层:排序层架构【用户、物品特征处理步骤】
Redisson 的分布式锁找不到?