当前位置:网站首页>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
边栏推荐
- The essence of high availability
- 端口复用和重映像
- LeetCode 715. Range 模块
- H3C vxlan configuration
- Enterprise manager cannot connect to the database instance
- Cmake command line use
- JVM 内存结构 详细学习笔记(一)
- Simulation volume leetcode [general] 1567 Length of the longest subarray whose product is a positive number
- Troublesome problem of image resizing when using typora to edit markdown to upload CSDN
- 9c09730c0eea36d495c3ff6efe3708d8
猜你喜欢

使用Typora编辑markdown上传CSDN时图片大小调整麻烦问题

【Istio Network CRD VirtualService、Envoyfilter】

面试题:高速PCB一般布局、布线原则

E-commerce campaign Guide

Simple use of Xray

Systick滴答定时器

STM32串口寄存器库函数配置方法

Recommended by Alibaba P8, the test coverage tool - Jacobo is very practical

2022-07-06 Unity核心9——3D动画

How to realize sliding operation component in fast application
随机推荐
为不同类型设备构建应用的三大更新 | 2022 I/O 重点回顾
C language for calculating the product of two matrices
The longest ascending subsequence model acwing 1017 Strange thief Kidd's glider
Port multiplexing and re imaging
[chaosblade: node CPU load, node network delay, node network packet loss, node domain name access exception]
模拟卷Leetcode【普通】1567. 乘积为正数的最长子数组长度
Upgrade Alibaba cloud RDS (relational database service) instance to com mysql. jdbc. exceptions. Troubleshooting of jdbc4.communicationsexception
Hard core sharing: a common toolkit for hardware engineers
JVM garbage collection detailed learning notes (II)
Problems encountered in the use of go micro
模拟卷Leetcode【普通】1706. 球会落何处
Druid monitoring - Introduction to JMX usage and principle
9c09730c0eea36d495c3ff6efe3708d8
C语言指针(上篇)
On December 8th, 2020, the memory of marketing MRC application suddenly increased, resulting in system oom
Unity Shader入门精要初级篇(一)-- 基础光照笔记
PMP Exam Preparation experience systematically improve project management knowledge through learning
How to count the number of project code lines
Platformization, a fulcrum of strong chain complementing chain
PMP examination experience sharing