当前位置:网站首页>MySQL most detailed DDL and DML operations
MySQL most detailed DDL and DML operations
2022-07-21 14:04:00 【Xiao Tang (๑ & gt; & lt; ๑)】
Catalog
5. Change the code of the database :
8. View all table names in the current database :
9. View the creation statement specifying a table :
12. Modify table , Add columns :
13. Modify table , Change column name and type :
14. Modify table , Delete column :
15. Modify the name of the table :
16. Insert data into a column :
17. Insert data into all columns :
18. Modify all columns in the data table ( to update )
19. Those in the data modification table that meet the conditions ( to update )
1. View all databases :
show databases;
2. Create database :
create database [if not exists] Database name [character set (utf8/gbk)];
3. Switch database :
use Database name ;
4. Delete database :
drop database [if exists] Database name ;
5. Change the code of the database :
alter database Database name character set utf8/gbk;
6. Create table :
create table if not exists Table name (
Name 1 type ,
Name 2 type
);
7. data type :
(1) value type :
int
tinyint
(2) Date and time type :
data--- Specific date
datatime--- Mm / DD / yyyy HHM / S
timestamp--- Automatically add year, day, hour, minute and second
(3) String type
char Fixed length string
varchar(20) Variable length string
decilmal(m,d);
Decimal type m-- Effective digits d-- Decimal digit
8. View all table names in the current database :
show tables;
9. View the creation statement specifying a table :
show create table Table name ;
10. View table structure :
desc Table name ;
11. Delete table
drop Table name ;
12. Modify table , Add columns :
alter table Table name add Name type ;
13. Modify table , Change column name and type :
alter table Table name change Old column names New column names type ;
14. Modify table , Delete column :
alter table Table name drop Name ;
15. Modify the name of the table :
rename table Table name to The new name of the table ;
16. Insert data into a column :
insert into Table name ( Name 1, Name 2....)values( value 1, value 2....);
17. Insert data into all columns :
insert into Table name values ( value 1, value 2, value 3...);
18. Modify all columns in the data table ( to update )
update Table name set Name = value ;
19. Those in the data modification table that meet the conditions ( to update )
update Table name set Name 1= value 1, Name 2= value 2 where Conditions ;
20. Deletion of data (1):
delete from Table name [where Conditions ];
21. Deletion of data (2):
turn cate Table name ;
notes :(1) In the absence of where In this case, the table is emptied
(2) Delete the table directly and re create it
边栏推荐
- STL 笔记(十二):关联性容器——集合
- Content requirements of detailed design specification
- NiO implements a simple group chat system
- JVM的前世今生及未来盘点
- Help enterprises' digital upgrading, and volcano engine releases cloud growth solutions
- 嵌入式工程师,用好C语言这一利器的三要素
- 《MySQL高级篇》四、索引的存储结构
- 【MLFP】《Face Presentation Attack with Latex Masks in Multispectral Videos》
- IO流概述
- Postman 最被低估的功能,90%的人不知道!
猜你喜欢
【WMCA】《Biometric Face Presentation Attack Detection with Multi-Channel Convolutional Neural Network》
Postman 最被低估的功能,90%的人不知道!
又一起.NET程序挂死, 用 Windbg 抽丝剥茧式的真实案例分析
渗透测试-命令执行注入
Mysql数据库查询好慢,除了索引,还能因为什么?
一元多项式的乘法与加法运算
PCL计算点云粗糙度
Help enterprises' digital upgrading, and volcano engine releases cloud growth solutions
The computer suddenly shows that there is only C disk, and other disks do not show ---- solution (very simple)
A CD and a floppy disk
随机推荐
想开户炒美原油,但是总是担心不安全怎么办?
Fuzzy query placeholder
_ Sort query
助力企业数字化升级,火山引擎发布云上增长解决方案
SAFe Day 2022 中国规模化敏捷大会将于11月5日召开
分组查询以及筛选的区别
Ireport export PDF font bold failure
高并发下如何防重?
详细设计说明书的内容要求
BCG 本地化
Selenium测试页面内容下载功能
(22)Blender源码分析之鼠标按下消息到窗口调用过程
云计算与数字化转型的关系,终于有人讲明白了
IO文件输入输出流
【软件测试】测试中的风险有哪些?
怎样才能让企业知识管理发挥出它的真正价值?
IO input / output stream
MySQL最详DDL和DML操作
5款经典代码阅读器的使用方案对比
CENTURY模型可以模拟土壤呼吸吗?CENTURY模型实践技术应用与案例分析