当前位置:网站首页>MySql 创建索引
MySql 创建索引
2022-08-03 04:08:00 【m0_54853503】
– (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开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- excerpt from compilation book
- 中非合作论坛非洲产品电商推广季启动 外交部:推动中非合作转型升级
- Redis-Redisson介绍和用途
- 【STM32】入门(四):外部中断-按键通过中断动作
- Chinese valentine's day??To the liver is the way!!!!!Auto. Js special position control method
- 工程制图第九章作业
- Problems that need to be solved for interrupting the system
- 【动态规划--01背包】HJ16 购物单
- lc marathon 8.2
- TCP 和UDP 的详细介绍
猜你喜欢
ESP8266-Arduino编程实例-MCP3008-ADC转换器驱动
道通转债,微芯转债,博22转债上市价格预测
DMA 的工作方式
Auto.js Pro write the first script hello world
高等代数_笔记_配方法标准化二次型
StarRocks July Community Update
"Obs" start pushing flow failure: the Output. The StartStreamFailed call process
种草一个让程序员男友编程时,记住一辈子的 IDEA 神仙插件!
浅谈用KUSTO查询语言(KQL)在Azure Synapse Analytics(Azure SQL DW)审计某DB账号的操作记录
Redis-Redisson介绍和用途
随机推荐
MediaRecorder录制屏幕时在部分机型上报错prepare failed:-22
Problems that need to be solved for interrupting the system
Chapter 8 Character Input Output and Input Validation
Pro * C Jin Cang database migration guide (4) KingbaseES Pro * C migration guide)
数字3d虚拟交互展厅顺应时代发展需求和趋势
【翻译】开发与生产中的Kubernetes修复成本对比
浏览器监听标签页关闭
WinForm(二):WinFrom中Main函数的入参和出参
肖sir__自动化面试题
excerpt from compilation book
Redis-Redisson介绍和用途
conda常用命令合集
I ported GuiLite to STM32F4 board
StarRocks July Community Update
7.Keras开发简介
Jincang Database Pro*C Migration Guide ( 5. Program Development Example)
v-on指令:为元素绑定事件
12.机器学习基础:评估机器学习模型
那些让电子工程师崩溃瞬间,你经历了几个呢?
记录一些遇见的bug——mapstruct和lombok同时使用时,转换实体类时数据丢失问题