2 thoughts on “What is DDL DML and DCL? How to use it best?”

  1. DDL (Data Language) Database Definition Language: In fact, it is some SQLs we used when creating a table, such as: Create, Alter, Drop, etc. DDL is mainly used in the structure, data types, links and constraints such as data types, data types, links and constraints between tables
    create table table name
    (
    name name 1 data type,
    -column name 2 data type,
    name name 3 data type,
    ....
    )

    alter table table_name
    alter column color datatype r r

    drop table table name
    drop database database name

    dml (data language) data manipulation language: is our most commonly used Select, update, insert, delete. It is mainly used to operate some database data.
    Select column name FROM table name
    update table name set name = new value where column = certain value
    Insert into table_name (column 1, column 2, ...) value 2, ....)
    DELETE from table name where the name = value

    DCL (data controlling) database control language: is a statement used to set or change the database user or role permissions, Including (Grant, Deny, Revoke, etc.) statements. This is less used.

  2. DDL: Data define language, which is used to define and manage the language of all objects in the SQL database
    1.create -to create objects in the database to create a database object
    2.alter -Alters the struct of the database modify the database对象rn3.DROP – delete objects from the database 删除数据库对象rn4.TRUNCATE – remove all records from a table, including all spaces allocated for the records are removedrnTRUNCATE TABLE [Table Name]。
    The following is a description of the Truncate statement in the middle usage and principles:
    truncate table is fast and high efficiency, because:
    truncate table, which has a delete statement that does not bring WHERE clauses. The same: both delete all the lines in the table. But Truncate Table is faster than Delete, and less systems and transaction log resources are used.
    DELETE statement deletes a line at a time, and records each row deleted in the transaction log. Truncate Table deletes data by releasing the data pages used in the storage table data, and only records the release of the page in the transaction log.
    The Jade Bird Ensong School will answer you.
    It hope to help you

Leave a Comment