当前位置:网站首页>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
边栏推荐
- 端口复用和重映像
- How can I apply for a PMP certificate?
- Locust performance test 2 (interface request)
- Newly found yii2 excel processing plug-in
- 硬件大熊原创合集(2022/05更新)
- Full link voltage test of the e-commerce campaign Guide
- Platformization, a fulcrum of strong chain complementing chain
- PMP examination experience sharing
- H3C VXLAN配置
- 使用Typora编辑markdown上传CSDN时图片大小调整麻烦问题
猜你喜欢
Hard core sharing: a common toolkit for hardware engineers
LeetCode 736. LISP syntax parsing
Output all composite numbers between 6 and 1000
[istio introduction, architecture, components]
LeetCode 715. Range 模块
Several stages of PMP preparation study
On December 8th, 2020, the memory of marketing MRC application suddenly increased, resulting in system oom
What is the use of PMP certificate?
Serial port experiment - simple data sending and receiving
The essence of high availability
随机推荐
LeetCode 715. Range 模块
端口复用和重映像
Several methods of calculating the average value of two numbers
What is the value of getting a PMP certificate?
年薪50w阿裏P8親自下場,教你如何從測試進階
Selenium mouse sliding operation event
Analysis of abnormal channel number information before and after AGC re signature service
Analysis of Hessian serialization principle
With an annual salary of 50W, Alibaba P8 will come out in person to teach you how to advance from testing
Un salaire annuel de 50 W Ali P8 vous montrera comment passer du test
Reflections on the way of enterprise IT architecture transformation (Alibaba's China Taiwan strategic thought and architecture practice)
LED模拟与数字调光
如何统计项目代码行数
ESP32-ULP协处理器低功耗模式RTC GPIO中断唤醒
Count the number of words C language
Common short chain design methods
OpenGL帧缓冲
Led analog and digital dimming
2022-06-30 Unity核心8——模型导入
JVM garbage collection detailed learning notes (II)