当前位置:网站首页>Basic SQL DDL
Basic SQL DDL
2022-07-27 23:03:00 【Cold Lane (* _*)】
Catalog
Table operations - Inquire about
Database operation
1. Inquire about
Query all databases
show databases;Querying the current database
select database();2. establish
create database [if not exists] Database name [default charset Character set ] [collate Sort rule ];3. Delete
drop database [if exists] Database name ;4. Use
use Database name ;Let's try

All databases are shown here
Created a new one called lengxiang The database of , Show Query OK Then the creation is successful !

like this , If there is already one named lengxiang The database of , If you create it again, you will report an error , Because it already exists .
Here is the execution of drop command , Deleted lengxiang This database .

use database , Then display the name of the current database .
Table operations - Inquire about
1. Query all tables in the current database
show tables;2. Query table structure
desc Table name ;3. Query the table creation statement of the specified table
show create table Table name ;Table operations - establish
create table Table name (
Field 1 Field 1 type [comment Field 1 notes ],
Field 2 Field 2 type [comment Field 2 notes ],
Field 3 Field 3 type [comment Field 3 notes ],
………………
Field n Field n type [comment Field n notes ]
)[comment Table annotation ];
Create a table
data type

modify
Add fields
alter table Table name add Field name type ( length ) [comment notes ] [ constraint ];Delete field
alter table Table name drop Field name ;Modify the name of the table
alter table Table name rename to The new name of the table ;Delete table
drop table [if exists] Table name ;Delete the specified table , And recreate the table
truncate table Table name ;边栏推荐
- [C language] simulate and implement string functions (Part 1)
- 2022/6/5 exam summary
- 2022年软件开发的趋势
- 2022/3/10 考试总结
- Introduction to the paper | language model for long text under transformer architecture
- You don't know about redis. Let me explain the underlying data structure of redis in detail
- Cy3荧光标记抗体/蛋白试剂盒 (10~100mg标记量)
- 组件的传参
- Excel only wants to visualize charts and make data move? Yes, come and watch (with a large number of templates to download)
- It is said that Intel will adopt TSMC 6nm EUV process next year
猜你喜欢

The follow-up is coming. Whether it's OK without reference, let's make it clear to everyone at once!

一篇搞定Redis中的BigKey问题

Understanding and use of third-party library

MySQL的B+Tree索引到底是咋回事?聚簇索引到底是如何长高的?

Trends in software development in 2022

Solve the problem that the last bit of IP address access is odd and even, or even and odd (the problem encountered when the cloud encryption machine connects to the cloud server, the whole process is

UDF and analysis cases of sparksql, 220726,,

视频人体行为检测

20 character short domain name bypass replication

Quartus:Instantiation of ‘sdram_ model_ plus‘ failed. The design unit was not found.
随机推荐
8000 word explanation of OBSA principle and application practice
UDF and analysis cases of sparksql, 220726,,
[NOI2018]归程(Kruskal重构树/可持久化并查集)
cron 表达式
Real time Bi (III) technical implementation of offline data and real-time data processing
US officials suggested trump prevent Infineon from acquiring cypress
[idea] fluency optimization
You don't know about redis. Let me explain the underlying data structure of redis in detail
Redis网红高频面试题三连:缓存穿透?缓存击穿?缓存雪崩?
MeterSphere金融公司落地经验分享
初中三年回忆录
[noi2018] bubble sort (combination + Cartland number +dp+ tree array)
It is said that Huawei will cut the order again! Supply chain manufacturers are more difficult
Here comes Gree mask! Kn95 mask only costs 5.5 yuan!
OPPO Find X2系列发布:3K+120Hz曲面屏,DXO评分第一,顶配版6999元!
Shuffle, partition and read of tfrecord
ADI, Shijian and Junlong technology jointly donated 2.3 million yuan to help fight the epidemic in Hubei
2022年五大网络管理趋势
对象创建过程及对象布局
追源码的平凡之路