文章目录
1. DDLCREATE2. DML1. DDL
DDL
=Data Definition Languages
=数据定义语言。
DDL or Data Definition Language actually consists of the SQL commands that can be used to define the database schema.
SQL最常见的DDL有三个:
CREATEDROPALTER
CREATE
语法:
自定义字段名和各自的数据类型
CREATE TABLE table_name(
column1 datatype,
column2 datatype,
column3 datatype,
…
columnN datatype,
PRIMARY KEY( one or more columns ) );
注意,PRIMARY KEY
后使用括号。
也可以从其他表格中取数据创建表格:
CREATE TABLE table_name SELECT 语句
,注意这里的SELECT语句
不能使用括号括起来。
2. DML
DML
=(Data Manipulation Language)
=数据操纵语句,它包含了大部分的SQL语句。
The SQL commands that deals with the manipulation of data present in the database belong to DML or Data Manipulation Language and this includes most of the SQL statements. I
有四个最常见
SELECTINSERTUPDATEDELETE
小结:简单来说DDL语言
的操作对象是数据库、是table,而占绝大多数的是DML语言
,它的操作对象可以理解为是table中的值。
参考:
SQL | DDL, DQL, DML, DCL and TCL Commands
如果觉得《SQL 的数据定义(DDL)语句 数据操纵(DML)语句》对你有帮助,请点赞、收藏,并留下你的观点哦!