当前位置:网站首页>MySQL common statements
MySQL common statements
2022-07-07 09:10:00 【Stick to this persistence】
preparation : Example of creating a table
CREATE TABLE `user` (
`id` int(11) NOT NULL COMMENT ' Primary key ',
`name` varchar(255) DEFAULT NULL COMMENT ' full name ',
`age` int(11) DEFAULT NULL COMMENT ' Age ',
`create_time` datetime DEFAULT NULL COMMENT ' Creation time ',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=' User table ';
explain : Table name :user, Database name :aaa.
1. mysql Query the field name of the table in the database 、 Attributes such as type and comment
1). Query statement :
SELECT
COLUMN_NAME,
DATA_TYPE,
COLUMN_COMMENT
FROM
information_schema. COLUMNS
WHERE
table_name = 'user'
AND table_schema = 'aaa';
2). Query results :
2. mysql Index query and addition
1). Query the index in the table :
SHOW INDEX FROM user
2). Add an index to a field :
ALTER TABLE `user` ADD INDEX idx_name (`name`);
explain :INDEX: General index .
3). Query results : explain :id Primary key , When you create or set a primary key ,mysql A unique index corresponding to the primary key will be automatically added , There is no need to add any more .
3. sql And DDL Statement operation
turn :https://blog.csdn.net/miachen520/article/details/51736333
边栏推荐
- Calf problem
- Analysis of abnormal channel number information before and after AGC re signature service
- PPT模板、素材下载网站(纯干货,建议收藏)
- Markdown editor Use of MD plug-in
- 为不同类型设备构建应用的三大更新 | 2022 I/O 重点回顾
- JVM 内存结构 详细学习笔记(一)
- PMP certificate preparation experience sharing
- 硬核分享:硬件工程师常用工具包
- 5A summary: seven stages of PMP learning
- Druid monitoring - Introduction to JMX usage and principle
猜你喜欢
随机推荐
【Istio Network CRD VirtualService、Envoyfilter】
How long does the PMP usually need to prepare for the exam in advance?
GoLand set goproxy
C language pointer (Part 1)
[istio introduction, architecture, components]
Reflections on the way of enterprise IT architecture transformation (Alibaba's China Taiwan strategic thought and architecture practice)
E-commerce campaign Guide
[chaosblade: delete pod according to the tag, pod domain name access exception scenario, pod file system i/o failure scenario]
Calf problem
2022-07-06 Unity核心9——3D动画
Unity shader beginner's Essentials (I) -- basic lighting notes
Original collection of hardware bear (updated on June 2022)
Storage of data in memory
Ppt template and material download website (pure dry goods, recommended Collection)
C语言指针(习题篇)
Enterprise manager cannot connect to the database instance
JVM garbage collection detailed learning notes (II)
Simulation volume leetcode [general] 1609 Parity tree
RuntimeError: Calculated padded input size per channel: (1 x 1). Kernel size: (5 x 5). Kernel size c
Interview question: general layout and wiring principles of high-speed PCB