当前位置:网站首页>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;边栏推荐
猜你喜欢

神经网络物联网平台搭建(物联网平台搭建实战教程)

node_exporter部署

Upgrade the smart switch, how much is the difference between the "zero fire version" and "single fire" wiring methods?

2022CoCa: Contrastive Captioners are Image-Text Fountion Models

The 300th weekly match of leetcode (20220703)

联想首次详解绿色智城数字孪生平台 破解城市双碳升级难点

更安全、更智能、更精致,长安Lumin完虐宏光MINI EV?

每日一题(2022-07-02)——最低加油次数

在线SQL转Excel(xls/xlsx)工具

The latest progress of Intel Integrated Optoelectronics Research promotes the progress of CO packaging optics and optical interconnection technology
随机推荐
添加命名空间声明
YOLOv5s-ShuffleNetV2
数组中的第K个最大元素
Safer, smarter and more refined, Chang'an Lumin Wanmei Hongguang Mini EV?
QT realizes interface sliding switching effect
Pointnet/Pointnet++点云数据集处理并训练
Hough transform Hough transform principle
Is it safe to open an account at Great Wall Securities? How to open an account when buying stocks
Master the use of auto analyze in data warehouse
Download the first Tencent technology open day course essence!
2014合肥市第三十一届青少年信息学奥林匹克竞赛(小学组)试题
爬虫(6) - 网页数据解析(2) | BeautifulSoup4在爬虫中的使用
页面元素垂直水平居中、实现已知或者未知宽度的垂直水平居中。
在线文本行固定长度填充工具
Wechat reading notes of "work, consumerism and the new poor"
Online sql to excel (xls/xlsx) tool
关于判断点是否位于轮廓内的一点思考
In flinksql, in addition to data statistics, is the saved data itself a state
1672. 最富有客户的资产总量
勾股数规律(任意三个数能够满足勾股定理需要满足的条件)