Introduction of DDL, DML and DCL in Sql statement

 1. DDL

DDL is Data Definition Language statements. Some examples: Data Definition Language, a language used to define and manage   all objects in a SQL database

1.CREATE - to create objects in the database 创建
2.ALTER - alters the structure of the database 修改
3.DROP - delete objects from the database 删除
4.TRUNCATE - remove all records from a table, including all spaces allocated for the records are removed

TRUNCATE TABLE [Table Name].
The following is a description of the usage and principle of the Truncate statement in MSSQLServer2000:
Truncate table table name is fast and efficient, because:
TRUNCATE TABLE is functionally the same as the DELETE statement without the WHERE clause: both delete the data in the table. All rows. But TRUNCATE TABLE is faster than DELETE and uses less system and transaction log resources.
The DELETE statement deletes one row at a time and records an entry in the transaction log for each row deleted. TRUNCATE TABLE deletes data by freeing the data pages used to store the table data, and only records the freeing of pages in the transaction log.
TRUNCATE TABLE deletes all rows in the table, but leaves the table structure and its columns, constraints, indexes, etc. unchanged. The count value used for new row identification is reset to the seed for this column. If you want to preserve the identity count value, use DELETE instead. If you want to drop the table definition and its data, use the DROP TABLE statement.
For tables referenced by FOREIGN KEY constraints, you cannot use TRUNCATE TABLE, but instead use a DELETE statement without a WHERE clause. Since TRUNCATE TABLE is not logged, it cannot activate triggers.
TRUNCATE TABLE cannot be used on tables participating in indexed views.
5. COMMENT - add comments to the data dictionary
6. GRANT - gives user's access privileges to database authorization
7. REVOKE - withdraw access privileges given with the GRANT command

2. DML

DML is Data Manipulation Language statements. Some examples: data manipulation language, operations such as processing data in SQL are collectively referred to as data manipulation language

1. SELECT - retrieve data from the a database query
2. INSERT - insert data into a table add
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 
Oracle RDBMS executes each SQL statement must be evaluated by the Oracle optimizer. Therefore, understanding how the optimizer chooses (search) paths and how indexes are used can be of great help in optimizing SQL statements. Explain can be used to quickly and easily find out how the query data in a given SQL statement was obtained, that is, the search path (we usually call it the Access Path). So that we choose the optimal query method to achieve the maximum optimization effect.
7.LOCK TABLE - control concurrency lock, used to control concurrency

3. DCL

DCL is Data Control Language statements. Some examples: Data Control Language, used to grant or revoke certain privileges to access the database, and control the time and effect of database manipulation transactions, monitor the database, etc.
COMMIT - save work done Submit
SAVEPOINT - identify a point in a transaction to which you can later roll back save point
ROLLBACK - restore database to original since the last COMMIT
SET TRANSACTION - Change transaction options like what rollback segment to use No effect.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325159916&siteId=291194637