当前位置:网站首页>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 |
边栏推荐
- Experience summary of the 12th Blue Bridge Cup (written for the first time)
- Contest3145 - the 37th game of 2021 freshman individual training match_ 1: Origami
- Setting methods, usage methods and common usage scenarios of environment variables in postman
- 微信公众号网页授权
- Redis notes (I) Linux installation process of redis
- 选择排序与冒泡排序模板
- JS object definition
- XSS prevention
- Cache general management class + cache httpcontext Current. Cache and httpruntime Differences between caches
- Recent learning fragmentation (14)
猜你喜欢

Development of digital collection trading platform development of digital collection platform

What kind of experience is it when the Institute earns 20000 yuan a month!

JVM family -- monitoring tools

How to use websocket to realize simple chat function in C #

Objective-C description method and type method

@Scheduled scheduled tasks

Want to do something in production? Then try these redis commands

National standard gb28181 protocol platform easygbs fails to start after replacing MySQL database. How to deal with it?

Jenkins continuous integration environment construction V (Jenkins common construction triggers)

In my spare time, I like to write some technical blogs and read some useless books. If you want to read more of my original articles, you can follow my personal wechat official account up technology c
随机推荐
Contest3145 - the 37th game of 2021 freshman individual training match_ J: Eat radish
Slurm view node configuration information
Zlmediakit compilation and webrtc push-pull flow testing
CSP drawing
Future源碼一觀-JUC系列
Solve the problems encountered by the laravel framework using mongodb
2022 registration examination for safety production management personnel of fireworks and firecracker production units and examination skills for safety production management personnel of fireworks an
Redis notes (I) Linux installation process of redis
A review of reverse reinforcement learning at Virginia Tech (VT)
Wechat official account web page authorization
System integration meets the three business needs of enterprises
XSS prevention
Imperial cms7.5 imitation "D9 download station" software application download website source code
JSON string conversion in unity
Want to do something in production? Then try these redis commands
投资深度思考
Leetcode51.n queen
The property of judging odd or even numbers about XOR.
Setting methods, usage methods and common usage scenarios of environment variables in postman
Backpropagation formula derivation [Li Hongyi deep learning version]