Talking about the difference between DML, DDL and DCL

1. DML

  • DML (data manipulation language) data manipulation language:

    It is the SELECT, UPDATE, INSERT, DELETE that we use most often. It is mainly used to perform some operations on the data in the database.

SELECT 列名称 FROM 表名称
UPDATE 表名称 SET 列名称 = 新值 WHERE 列名称 = 某值
INSERT INTO table_name (列1, 列2,...) VALUES (值1, 值2,....)
DELETE FROM 表名称 WHERE 列名称 = 值

2. DDL

  • DDL (data definition language) database definition language:

    In fact, it is some sql we use when creating tables, such as: CREATE, ALTER, DROP, etc. DDL is mainly used to define or change the structure of tables, data types, links and constraints between tables and other initialization work

CREATE TABLE 表名称
(
列名称1 数据类型,
列名称2 数据类型,
列名称3 数据类型,
....
)

ALTER TABLE table_name
ALTER COLUMN column_name datatype

DROP TABLE 表名称
DROP DATABASE 数据库名称

 

3. DCL

  • DCL (Data Control Language) database control language:

    It is a statement used to set or change database user or role permissions, including (grant, deny, revoke, etc.) statements. This is less used.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326692646&siteId=291194637