当前位置:网站首页>Concepts and differences of DQL, DML, DDL and DCL

Concepts and differences of DQL, DML, DDL and DCL

2022-06-23 06:50:00 Small code 2016

SQL(Structure Query Language) Language is the core language of database .

SQL Our development is from 1974 Year begins , Its development process is as follows : 1974 year ----- from Boyce and Chamberlin Put forward , It was called SEQUEL. 1976 year -----IBM The company's Sanjase The Institute has developed RDBMS SYSTEM R Change to SQL. 1979 year -----ORACLE The company's first publication is based on SQL The commercialization of the RDBMS product . 1982 year -----IBM The company published the first RDBMS Language SQL/DS. 1985 year -----IBM The company published the first RDBMS Language DB2. 1986 year ----- The national organization for Standardization ANSI announce SQL As a database industry standard . SQL Is a standard database language , It's a set oriented descriptive nonprocedural language . It's powerful , Efficient , Easy to learn, easy to maintain ( so far , I haven't seen anything better than it The language you learn ). However SQL Language because of the above advantages , At the same time, there is such a problem : It's nonprocedural language , That is, most statements are executed independently , It's not about context , and Most applications are a complete process , Obviously with SQL It's very difficult to fully implement these functions Difficult . So most database companies are trying to solve this problem , We have done the following two aspects : (1) expand SQL, stay SQL Introduce the procedural structure into the process ;(2) hold SQL Embedded in high level language , In order to complete a complete application together .

Two . SQL The classification of languages
SQL Language can be divided into four categories : Data query language DQL, Data manipulation language DML, Data definition language DDL, Data control language DCL.

  1. Data query language DQL Data query language DQL The basic structure is made up of SELECT Clause ,FROM Clause ,WHERE The query block made up of clauses : SELECT < Field name table > FROM < Table or view name > WHERE < Query criteria >
    2 . Data manipulation language DML Data manipulation language DML There are three main forms : 1) Insert :INSERT 2) to update :UPDATE 3) Delete :DELETE
  2. Data definition language DDL Data definition language DDL Used to create various objects in the database ----- surface 、 View 、 Indexes 、 A synonym for 、 Clustering, etc : CREATE TABLE/VIEW/INDEX/SYN/CLUSTER | | | | | surface View Indexes A synonym for cluster

DDL The operation is implicitly submitted ! You can't rollback
4. Data control language DCL Data control language DCL To grant or reclaim access to a database , And control Time and effect of database manipulation transaction , Monitor the database . Such as : 1) GRANT: to grant authorization .

  1. ROLLBACK [WORK] TO [SAVEPOINT]: Go back to a certain point . Roll back —ROLLBACK The rollback command returns the database state to the last committed state . The format for : SQL>ROLLBACK;

  2. COMMIT [WORK]: Submit .

    Insert in database 、 When deleting and modifying operations , Only when the transaction is committed to data It's only when it's in storage . Before the transaction is committed , Only the person who operates the database has the right to see To what is done , Others can only see... After the final submission . There are three types of submitted data : Explicitly commit 、 Implicit and automatic submission . The following points Don't say these three types .

(1) Explicitly commit use COMMIT The commit done directly by the command is an explicit commit . The format for : SQL>COMMIT;

(2) Implicitly submit use SQL The commit done indirectly by the command is an implicit commit . These orders are : ALTER,AUDIT,COMMENT,CONNECT,CREATE,DISCONNECT,DROP, EXIT,GRANT,NOAUDIT,QUIT,REVOKE,RENAME.

(3) Automatic submission If the AUTOCOMMIT Set to ON, Then insert 、 modify 、 After the delete statement is executed , The system will automatically submit , This is auto submit . The format for : SQL>SET AUTOCOMMIT ON;

https://www.cnblogs.com/springwind268/p/3895839.html

原网站

版权声明
本文为[Small code 2016]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/174/202206230538129685.html