Difference between DDL, DML, and DCL and difference between ddldmldcl

Source: Internet
Author: User

Difference between DDL, DML, and DCL and difference between ddldmldcl

The weather was overcast on January 1, May 31, 2017. There have been many things recently, and my mood is heavy.

I had just passed the Dragon Boat Festival and attended classes in the morning. Many of my classmates were still in the tired state of the Dragon Boat Festival and did not go back. Of course, I am no exception. Three days of Dragon Boat Festival, coupled with the completion of the work, can be said to be physically and mentally exhausted. The status is not good. After sorting out the previous notes, I found that many knowledge points were hard to remember and even some were barely impressed. The following describes the differences and understandings between DDL, DML, and DCL for later viewing.

1. DDL (data definition language)-the language used to define and manage all objects in the SQL database

DDL Commands include CREATE, ALTER, and DROP. DDL is mainly used to define or change the TABLE structure, data type, links and constraints between tables, and other initialization tasks, most of them are used when creating tables.

(1) CREATE-to create objects in the database creation

(2) ALTER-alters the structure of the database Modification

(3) DROP-delete objects from the database to delete

(4) TRUNCATE-remove all records from a table, including all spaces allocated for the records are removed truncate table [Table Name].

(5) COMMENT-add comments to the data dictionary Annotation

(6) GRANT-gives user's access privileges to database authorization

(7) REVOKE-withdraw access privileges given with the GRANT command to REVOKE the granted Permissions

2. DML (data manipulation language)-data operation language. operations such as data processing in SQL are collectively referred to as data operation languages.

 

They are SELECT, UPDATE, INSERT, and DELETE, just like their names. These four commands are used to operate on the data in the database.

(1) SELECT-retrieve data from the database Query

(2) Add INSERT-insert data into a table

(3) UPDATE-updates existing data within a table UPDATE

(4) DELETE-deletes all records from a table, the space for the records remain DELETE

(5) CALL-call a PL/SQL or Java subprogram

(6) explain plan-explain access path to data

(7) lock table-control concurrency LOCK, used to control concurrency

3. DCL (Data Control Language) is a Data Control Language used to grant or revoke some special privileges to access the database, Control the time and Effect of database operations, and monitor the database.

 

The database control function is used to set or change database user or role permissions, including grant, deny, revoke, and other statements. By default, only sysadmin, dbcreator, db_owner, db_securityadmin, and other personnel are authorized to execute the DCL explanation.

(1) COMMIT-save work done submit

(2) SAVEPOINT-identify a point in a transaction to which you can later roll back save point

(3) ROLLBACK-restore database to original since the last COMMIT ROLLBACK

(4) set transaction-Change transaction options like what rollback segment to use sets the features of the current TRANSACTION, which has no effect on subsequent transactions

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.