当前位置:网站首页>Mysql database basic operation -ddl | dark horse programmer
Mysql database basic operation -ddl | dark horse programmer
2022-07-04 19:33:00 【Dark horse programmer official】
MySQL Strong performance , It is one of the most widely used databases at present , With MySQL For learning the prototype, it is also convenient to master other databases later , Now let's give you Give a comprehensive explanation MySQL8.0 New features , From zero foundation to high-level one-stop learning , Combined with actual cases, we can gain something !
▼ MySQL8.0 introduction - Advanced learning notes :( Summary )
- The first 1 speak :SQL Overview and database system introduction | Black horse programmer
- The first 2 speak :MySQL brief introduction 、 Detailed installation steps and use | Black horse programmer
- The first 3 speak :MySQL Common graphics management tools | Black horse programmer
1、DDL explain
DDL(Data Definition Language), Data definition language , The language section includes the following :
- Common operations on Database
- Common operations on table structure
- Modify table structure
2、 Common operations on Database
Common operations on table structure - Create table
- Create a table format
Creating a table is to build an empty table , Specify the name of this table , This table has several columns , What is the name of each column , And the type of data stored in each column .
- data type
Data type refers to specifying the data type for the fields in the table when creating the table , Only if the data meets the type requirements can it be stored , The principle of using data types is : Enough is enough. , Try to use a small range of , Not the big one , This can save more storage space .
- value type
- Date and time type
- String type
3、 Common operations on table structure — Other operating
- Modify the table to add columns
Grammar format
alter table Table name add Name type ( length ) [ constraint ];
Example :
# by student Add a new field to the table as : Is don't dept The type is varchar(20)
ALTER TABLE student ADD `dept` VARCHAR(20); - Change column name and type
Grammar format
alter table Table name change Old column names New column names type ( length ) constraint ; Example
# by student Tabular dept Replace field with department varchar(30)
ALTER TABLE student change `dept` department VARCHAR(30);- Modify table delete column
Grammar format
alter table Table name drop Name ;Example
# Delete student In the table department This column
ALTER TABLE student DROP department;- Modify the name of the table
Grammar format
rename table Table name to The new name of the table ;
Example
# Will table student Change its name to stu
rename table `student` to stu;边栏推荐
- LeetCode第300场周赛(20220703)
- Online sql to excel (xls/xlsx) tool
- Shell 编程核心技术《三》
- OpenCV的二值化处理函数threshold()详解
- QT realizes interface sliding switching effect
- Shell 编程核心技术《一》
- 876. Intermediate node of linked list
- PointNeXt:通过改进的模型训练和缩放策略审视PointNet++
- There are multiple divs in the large div, which are displayed on the same line. After overflow, scroll bars are generated without line breaks
- Hough transform Hough transform principle
猜你喜欢

Oracle with as ORA-00903: invalid table name 多表报错

Comment utiliser async awati asynchrone Task Handling au lieu de backgroundworker?

To sort out messy header files, I use include what you use

There are multiple divs in the large div, which are displayed on the same line. After overflow, scroll bars are generated without line breaks

Explore the contour drawing function drawcontours() of OpenCV in detail with practical examples

Nebula importer data import practice

2022CoCa: Contrastive Captioners are Image-Text Fountion Models

Pytorch学习(四)

建立自己的网站(15)

Use canal and rocketmq to listen to MySQL binlog logs
随机推荐
Wechat reading notes of "work, consumerism and the new poor"
安徽 中安在线文旅频道推出“跟着小编游安徽”系列融媒体产品
生成XML元素
YOLOv5s-ShuffleNetV2
LeetCode第300场周赛(20220703)
请教一下 flinksql中 除了数据统计结果是状态被保存 数据本身也是状态吗
性能优化之关键渲染路径
One question per day (2022-07-02) - Minimum refueling times
FPGA时序约束分享01_四大步骤简述
2021 合肥市信息学竞赛小学组
From automation to digital twins, what can Tupo do?
ftp、sftp文件传输
大div中有多个div,这些div在同一行显示,溢出后产生滚动条而不换行
Introduction to polyfit software
Lm10 cosine wave homeopathic grid strategy
Unity editor extends C to traverse all pictures in folders and subdirectories
牛客小白月赛7 F题
HDU 6440 2018中国大学生程序设计网络选拔赛
Go微服务(二)——Protobuf详细入门
求2的n次方