当前位置:网站首页>mysql 创建索引的三种方式
mysql 创建索引的三种方式
2022-07-29 00:16:00 【m0_67393157】
1、使用CREATE INDEX创建,语法如下:
CREATEINDEXindexNameONtableName(columnName(length));
2、使用ALTER语句创建,语法如下:
ALTERTABLEtableNameADDINDEXindexName(columnName);
ALTER语句创建索引,下面提供一个设置索引长度的例子:
ALTERTABLEt_user_action_logADDINDEXip_address_idx(ip_address(16));
SHOWINDEXFROMt_user_action_log;
3、建表的时候创建索引
CREATETABLEtableName(
idINTNOTNULL,
columnNamecolumnType,
INDEX[indexName](columnName(length))
);
示例:

边栏推荐
- How to carry out engineering implementation of DDD Domain Driven Design
- Visual full link log tracking
- Cookie和Session
- Hash table~
- 【mysql】多指标历史累计去重问题
- How to smoothly go online after MySQL table splitting?
- ACM SIGIR 2022 | 美团技术团队精选论文解读
- [Commons lang3 topic] 004- numberutils topic
- SDRAM Controller Design (two design methods of digital controller)
- Hilbert transform and instantaneous frequency
猜你喜欢

【Leetcode-滑动窗口问题】

Introduction to FLV documents

Principle and usage setting of large page memory

This article enables you to understand the underlying principle of MySQL- Internal structure, index, lock, cluster

Canal real-time parsing MySQL binlog data practice

Inftnews | yuanuniverse shopping experience will become a powerful tool to attract consumers

Cookie和Session

ACM SIGIR 2022 | interpretation of selected papers of meituan technical team

QT static compiler (MinGW compilation)

ThinkPHP high imitation blue cloud disk system program
随机推荐
(完美解决)为什么在train/val/test数据集上用train模式效果都很好,但是在eval模式下全部很差
正则校验与时间格式化
[web development] basic knowledge of flask framework
【刷题笔记】链表内指定区间反转
[Commons lang3 topic] 004- numberutils topic
Deep learning | matlab implementation of TCN time convolution neural network spatialdropoutlayer parameter description
system verilog常用语法
solidity实现智能合约教程(5)-NFT拍卖合约
写作作业一
Digital twin rail transit: "intelligent" monitoring to clear the pain points of urban operation
【Jenkins笔记】入门,自由空间;持续集成企业微信;allure报告,持续集成电子邮件通知;构建定时任务
mysql分表之后怎么平滑上线?
Synchronized关键字详解
【刷题笔记】从链表中删去总和值为零的连续节点
Machine learning | matlab implementation of RBF radial basis function neural network Newrbe parameter setting
Canal real-time parsing MySQL binlog data practice
【ManageEngine】助力哈尔滨工程大学实现网络流量一体化监控管理
Return the member function of *this
[notes for question brushing] binary linked list to integer
北京护照西班牙语翻译推荐