当前位置:网站首页>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 |
边栏推荐
- [PaddleSeg 源码阅读] PaddleSeg Transform 的 Normalize操作
- Don't disagree, this is the most powerful "language" of the Internet
- warning: LF will be replaced by CRLF in XXXXXX
- JVM family -- heap analysis
- JS object definition
- Backpropagation formula derivation [Li Hongyi deep learning version]
- MySQL is dirty
- Zigzag scan
- What is cloud primordial?
- Formulaire day05
猜你喜欢

What is cloud primordial?

Webhook triggers Jenkins for sonar detection

MySQL query

Jenkins continuous integration environment construction V (Jenkins common construction triggers)
![[Wu Enda deep learning] beginner learning record 3 (regularization / error reduction)](/img/e9/818bdfeae766dca7d2318b52b4424d.jpg)
[Wu Enda deep learning] beginner learning record 3 (regularization / error reduction)

This function has none of DETERMINISTIC, NO SQL..... (you *might* want to use the less safe log_bin_t

@Scheduled scheduled tasks

Zhihu million hot discussion: why can we only rely on job hopping for salary increase? Bosses would rather hire outsiders with a high salary than get a raise?

Rhcsa day 2

Setting methods, usage methods and common usage scenarios of environment variables in postman
随机推荐
Package details_ Four access control characters_ Two details of protected
[Valentine's Day confession code] - Valentine's Day is approaching, and more than 10 romantic love effects are given to the one you love
Which product is better for 2022 annual gold insurance?
Recursive structure
Zhihu million hot discussion: why can we only rely on job hopping for salary increase? Bosses would rather hire outsiders with a high salary than get a raise?
What is the difference between enterprise wechat applet and wechat applet
system information
How about the ratings of 2022 Spring Festival Gala in all provinces? Map analysis helps you show clearly!
Object oriented -- encapsulation, inheritance, polymorphism
MySQL query
[development team follows] API specification
static hostname; transient hostname; pretty hostname
Contest3145 - the 37th game of 2021 freshman individual training match_ F: Smallest ball
What kind of experience is it when the Institute earns 20000 yuan a month!
super_ Subclass object memory structure_ Inheritance tree traceability
機器學習基礎:用 Lasso 做特征選擇
Add token validation in swagger
Short math guide for latex by Michael downs
Hospital network planning and design document based on GLBP protocol + application form + task statement + opening report + interim examination + literature review + PPT + weekly progress + network to
Constantly changing harmonyos custom JS components during the Spring Festival - Smart Koi