Vice-added knowledge, common database to DML and DDL meaning (DCL containing instructions).

Recent projects do sql stored procedure development, called dbeaver with a visual database connectivity tools, database-driven is DB2, see predecessors wrote a dataBaseName.functionName (database name Function name) (Figure A), very strange, DB2 I also used the first time, this function points into the data to see only two, the second column is called DDL, this column which recorded a few lines of sql, appears to be the return type of a decimal 8-digit date, it is curious DDL rolled to related words like Baidu

(A)

 

DDL (the Data Definition Language) database definition language:

In fact, what we used when creating the table some sql, for example: CREATE, ALTER, DROP and so on. DDL is mainly used in the definition or changing the structure of the table, the data type, the link between the tables and constraints initialization work.

1.CREATE TABLE table name (Column Name Data Type 1, Type 2 Data column names, column names, data type 3, ....)

2.ALTER TABLE table_name (or modified column)

4.DROP TABLE table name

5.DROP DATABASE database name (with caution)

6.create index create index, drop index deletes index

 

 

The DML (Data Manipulation Language) data manipulation language:

This very simple matter, writes the daily development of table data sql: SELECT, UPDATE, INSERT, DELETE.

SELECT column names FROM table

UPDATE table SET column name = new values, new column name = value WHERE column name = some value

INSERT INTO tableName (column 1, column 2, ...) the VALUES (value 1, value 2, ....)

DELETE FROM table name WHERE column name = value

 

 

Summary The following two differences:

DML is SELECT, UPDATE, INSERT, DELETE, which four language command is used to operate the database of the data.

The main DDL commands are CREATE, ALTER, DROP, etc., is mainly used in the DDL definition or changing the structure of the TABLE, the data type, the link between the tables and constraints initialization work, most of them in the establishment of a table or database function (establish a sql function for other stored procedure call execution) use.

 

           -------------------------------------------------------------------------------------------------------------------------------------------------------

When turned to find two new small land, the following is an unknown big brother to supplement:

DCL (Data Control Language) - Data Control Language, used to grant a privilege or recover access to the database, and database manipulation to control the time and the effect of the transaction occurs, monitor the implementation of the database.

Database control function is used to set or change the database user or role privileges statements, including grant, deny, revoke and other statements. By default, only the sysadmin, dbcreator, db_owner or db_securityadmin and other staff have the power to execute DCL explained in detail.

(1) COMMIT - save work done submit

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

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

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

 TCL - Transaction Control Language: Transaction Control Language, COMMIT - save work done, SAVEPOINT - save set points in a transaction, you can roll back to here, ROLLBACK - rollback, SET TRANSACTION - changes in transaction option

Published an original article · won praise 1 · views 75

Guess you like

Origin blog.csdn.net/f_u_c_k_le/article/details/105270140