当前位置:网站首页>Database SQL statement summary, continuous update
Database SQL statement summary, continuous update
2022-07-04 03:37:00 【Anti insider senior officials】
Catalog
1 SQL sentence Database related operations
1.1 Create and open a database
1 SQL sentence Database related operations
The goal is :
Will use SQL Statement to create a new database 、 Use 、 edit 、 Delete 、 Close operation .
1.1 Create and open a database
New database
Grammar format | Basic usage create database < Database name > | Syntax format with parameters : create database [if not exists] < Database name > [charset Character set ] [collate Sort rule ] |
---|---|---|
Reverberation | ||
Parameter description | if not exists —— If the database does not exist, create , If it exists, it will not report an error ; charset Character set —— The default value is utf8mb4; collate Sort rule —— The default value is utf8mb4_0900_ai_ci; | |
Illustrate with examples | # Create a name student The database of create database student; | # Create a name teacher The database of , Repeat the command without error create database if not exists teacher; # Create a name school The database of , Specify the character set and collation create database if not exists school charset utf8mb4 collate utf8_general_ci; |
remarks | Repeated command input will report an error | Character set is the code made to be compatible with the characters of various countries , such as GB2312、GBK etc. , We use utf8; |
Open database
Grammar format | Basic grammar use Database name |
---|---|
Reverberation | |
Parameter description | |
Illustrate with examples | # open student database use student; |
remarks |
1.2 Delete database
Grammar format | # Basic grammar drop database < Database name > | # Syntax with parameters drop database [if exists] < Database name > |
---|---|---|
Reverberation | ||
Parameter description | ||
Illustrate with examples | # Delete student database drop database student; | # Delete student database drop database if exists student; |
remarks |
1.3 Edit the database
Grammar format | alter database < Database name > [default character set Character set ] [default collate Sort rule ] |
---|---|
Reverberation | |
Parameter description | |
Illustrate with examples | # Create a name test The database of , The character set is gb2132 create database test charset gb2312; # modify test The specified character set is utf8mb4, The sorting rule is utf8mb4_general_ci; alter database test default character set utf8mb4 default collate utf8mb4_general_cli; |
remarks | [default character set Character set ] You can also make mistakes [default charset Character set ] |
1.4 Query the database
command | explain |
---|---|
show databases; | View all databases |
select database(); | View currently used databases |
show create database Database name ; | View creation xxx The syntax of the database |
边栏推荐
- 渗透实战-guest账户-mimikatz-向日葵-sql提权-离线解密
- CSP drawing
- Eh, the log time of MySQL server is less than 8h?
- Osnabrueck University | overview of specific architectures in the field of reinforcement learning
- MySQL one master multiple slaves + linear replication
- Examination question bank of constructor decoration direction post skills (constructor) and examination data of constructor decoration direction post skills (constructor) in 2022
- 2022-07-03:数组里有0和1,一定要翻转一个区间,翻转:0变1,1变0。 请问翻转后可以使得1的个数最多是多少? 来自小红书。3.13笔试。
- functools下的reduce函数
- Aperçu du code source futur - série juc
- [database I] database overview, common commands, view the table structure of 'demo data', simple query, condition query, sorting data, data processing function (single row processing function), groupi
猜你喜欢
Management and thesis of job management system based on SSM
What is the difference between enterprise wechat applet and wechat applet
2022-07-03:数组里有0和1,一定要翻转一个区间,翻转:0变1,1变0。 请问翻转后可以使得1的个数最多是多少? 来自小红书。3.13笔试。
Lichuang EDA learning notes 14: PCB board canvas settings
MySQL maxscale realizes read-write separation
150 ppt! The most complete "fair perception machine learning and data mining" tutorial, Dr. AIST Toshihiro kamishima, Japan
Es network layer
1day vulnerability pushback skills practice (3)
New year's first race, submit bug reward more!
[source code analysis] model parallel distributed training Megatron (5) -- pipestream flush
随机推荐
Audio and video technology development weekly | 232
Object oriented -- encapsulation, inheritance, polymorphism
潘多拉 IOT 开发板学习(HAL 库)—— 实验6 独立看门狗实验(学习笔记)
Want to do something in production? Then try these redis commands
微信公众号网页授权
Slurm view node configuration information
The difference between MCU serial communication and parallel communication and the understanding of UART
Backpropagation formula derivation [Li Hongyi deep learning version]
Tsinghua University product: penalty gradient norm improves generalization of deep learning model
Short math guide for latex by Michael downs
Zigzag scan
This function has none of DETERMINISTIC, NO SQL..... (you *might* want to use the less safe log_bin_t
What is cloud primordial?
2006 translation
[untitled]
PMP 考試常見工具與技術點總結
National standard gb28181 protocol platform easygbs fails to start after replacing MySQL database. How to deal with it?
PID of sunflower classic
Which product is better if you want to go abroad to insure Xinguan?
数据库SQL语句汇总,持续更新......