当前位置:网站首页>My SQL (II)
My SQL (II)
2022-06-26 06:43:00 【The code family】
DDL- Database operation
One . Inquire about
1. Query all the data
SHOW DATABASES;
2. Querying the current database
SELECT DATABASE();
Two . establish
CREATE DATABASE[ IF NOT EXISTS ] Database name [DEFAULT CHARSET Character set ] [COLLATE Arrange in order ];
3、 ... and . Delete
DROP DATABASE[IF EXISTS] Database name ;
Four . Use
USE Database name ;
DDL- Table operations - Inquire about
One . Query all tables in the current database
SHOW TABLES;
Two . Query table structure
DESC Table name ;
3、 ... and . Query the table creation statement of the specified table
SHOW CREATE TABLE Table name ;
DDL- Table operations - establish
CREATE TABLE Table name (
Field 1 Field 1 type [COMMENT Field 1 notes ],
Field 2 Field 2 type [COMMENT Field 2 notes ],
Field 3 Field 3 type [COMMENT Field 3 notes ],
……
Field n Field n type [COMMENT Field n notes ]
)[COMMENT Table annotation ];
Be careful :[…] Is an optional parameter , There is no comma after the last field
DDL- Table operations - data type
value type
String type
The date type
DDL- Table operations - modify
One . Add fields
ALTER TABLE Table name ADD Field name type ( length )[COMMENT notes ] [ constraint ];
Two . Change data type
ALTER TABLE Table name MODIFY Field name New data types ( length );
3、 ... and . Modify the field name and field type
ALTER TABLE Table name CHANGE Old field name new field name type ( length )[COMMENT notes ] [ constraint ];
Four . Delete field
ALTER TABLE Table name DROP Field name ;
5、 ... and . Modify the name of the table
ALTER TABLE Table name RENAME TO The new name of the table ;
DDL- Table operations - Delete
One . Delete table
DROP TABLE[IF EXISTS] Table name ;
Two . Delete the specified table , And recreate the table
TRUNCATE TABLE Table name ;
Be careful : When deleting a table , All data in the table
边栏推荐
- Load balancer does not have available server for client: userService问题解决
- Bugku exercise ---misc--- prosperity, strength and democracy
- Distribution operation of D
- 我在腾讯做测试的这几年...
- Installing rainbow in various kubernetes with Helm
- Introduction to the use of TS generics in functions, interfaces and classes
- Evolution history of qunar Bi platform construction
- LightGBM--调参笔记
- Open source demo| you draw and I guess -- make your life more interesting
- MYSQL触发器要如何设置,简单教程新手一看就会
猜你喜欢

我在腾讯做测试的这几年...

100 cases of go language

Ppt template crawler case
Alarm operation and Maintenance Center | build an efficient and accurate alarm collaborative processing system
![[micro service series] protocol buffer dynamic analysis](/img/86/357d55c77cc67d6413af2de59bf395.png)
[micro service series] protocol buffer dynamic analysis

Kotlin Compose 状态恢复 rememberSaveable 与 remember
![[golang] time related](/img/10/56c0031e11677a91a50cda7d8a952f.png)
[golang] time related

MySQL基础用法01

【golang】time相关

I have been testing at Tencent for several years
随机推荐
Top down transformation method
Web components series (10) -- realize the basic layout of mycard
Use the fast proxy to build your own proxy pool (mom doesn't have to worry about IP being blocked anymore)
Research Report on pallet handling equipment industry - market status analysis and development prospect forecast
Spark3.3.0源码编译补充篇-抓狂的证书问题
视图简析
Load balancer does not have available server for client: userservice problem solving
直播预告丨消防安全讲师培训“云课堂”即将开讲!
Zotero使用之自定义参考文献格式
Live broadcast Preview - fire safety instructor training "cloud class" is about to start!
[micro service series] protocol buffer dynamic analysis
C# Nuget离线缓存包安装
遇到女司机业余开滴滴,日入500!
如何让主线程等待子线程执行完毕后再执行
View analysis
Mysql delete in 不走索引的
DPDK——TCP/UDP协议栈服务端实现(一)
ts中枚举类型(enum)简单使用
自顶向下的变成方法
GoF23—工厂模式