当前位置:网站首页>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 |
边栏推荐
- 2022 attached lifting scaffold worker (special type of construction work) free test questions and attached lifting scaffold worker (special type of construction work) examination papers 2022 attached
- PMP 考試常見工具與技術點總結
- Typical applications of minimum spanning tree
- Contest3145 - the 37th game of 2021 freshman individual training match_ D: Ranking
- SQL語句加强練習(MySQL8.0為例)
- [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
- Easy to win insert sort
- How to use websocket to realize simple chat function in C #
- 基於.NetCore開發博客項目 StarBlog - (14) 實現主題切換功能
- MySQL data query optimization -- data structure of index
猜你喜欢
Wechat official account web page authorization
The 37 year old programmer was laid off, and he didn't find a job for 120 days. He had no choice but to go to a small company. As a result, he was confused
Cache general management class + cache httpcontext Current. Cache and httpruntime Differences between caches
Katalon框架测试web(二十六)自动发邮件
MySQL is dirty
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?
Why is it recommended that technologists write blogs?
Objective-C description method and type method
The difference between MCU serial communication and parallel communication and the understanding of UART
How about the ratings of 2022 Spring Festival Gala in all provinces? Map analysis helps you show clearly!
随机推荐
System integration meets the three business needs of enterprises
Is it really so difficult to learn redis? Today, a fan will share his personal learning materials!
2022 Guangxi provincial safety officer a certificate examination materials and Guangxi provincial safety officer a certificate simulation test questions
Explain AI accelerator in detail: why is this the golden age of AI accelerator?
Command Execution Vulnerability - command execution - vulnerability sites - code injection - vulnerability exploitation - joint execution - bypass (spaces, keyword filtering, variable bypass) - two ex
Eh, the log time of MySQL server is less than 8h?
New year's first race, submit bug reward more!
Fudan released its first review paper on the construction and application of multimodal knowledge atlas, comprehensively describing the existing mmkg technology system and progress
logistic regression
Setting methods, usage methods and common usage scenarios of environment variables in postman
1day vulnerability pushback skills practice (3)
Apple submitted the new MAC model to the regulatory database before the spring conference
system information
SQL語句加强練習(MySQL8.0為例)
MySQL one master multiple slaves + linear replication
What is cloud primordial?
基于PHP的轻量企业销售管理系统
2022-07-03:数组里有0和1,一定要翻转一个区间,翻转:0变1,1变0。 请问翻转后可以使得1的个数最多是多少? 来自小红书。3.13笔试。
warning: LF will be replaced by CRLF in XXXXXX
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