資料庫的四種語言(DDL、DML、DCL、TCL)

來源:互聯網
上載者:User

標籤:

1.DDL (Data Definition Language )資料庫定義語言 statements are used to define the database structure or schema.

DDL是SQL語言的四大功能之一。
用於定義資料庫的三級結構,包括外模式、概念模式、內模式及其相互之間的映像,定義資料的完整性、安全控制等約束
DDL不需要commit. 
CREATE 
ALTER 
DROP 
TRUNCATE 
COMMENT 
RENAME 

2.DML (Data Manipulation Language資料操縱語言 statements are used for managing data within schema objects.

由DBMS提供,用於讓使用者或程式員使用,實現對資料庫中資料的操作。 
DML分成互動型DML和嵌入型DML兩類。
依據語言的層級,DML又可分成過程性DML和非過程性DML兩種。
需要commit. 
SELECT 
INSERT 
UPDATE 
DELETE 
MERGE 
CALL 
EXPLAIN PLAN 
LOCK TABLE 

3.DCLData Control Language資料庫控制語言  授權,角色控制等 
GRANT 授權 
REVOKE 取消授權 

4.TCLTransaction Control Language事務控制語言
SAVEPOINT 設定儲存點 
ROLLBACK  復原
SET TRANSACTION

SQL主要分成四部分
(1)資料定義。(SQL DDL)用於定義SQL模式、基本表、視圖和索引的建立和撤消操作。
(2)資料操縱。(SQL DML)資料操縱分成資料查詢和資料更新兩類。資料更新又分成插入、刪除、和修改三種操作。
(3)資料控制。包括對基本表和視圖的授權,完整性規則的描述,事務控制等內容。
(4)嵌入式SQL的使用規定。涉及到SQL語句嵌入在宿主語言程式中使用的規則。

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

什麼是DDL?
DDL是Data definition Language 的縮寫,意為資料定義語言 (Data Definition Language),是SQL語言的四大功能之一。
用於定義資料庫的三級結構,包括外模式、概念模式、內模式及其相互之間的映像,定義資料的完整性、安全控制等約束。

什麼是DML?
DML是Data Manipulation Language的縮寫,意為資料操縱語言,是SQL語言的四大功能之一。
由DBMS提供,用於讓使用者或程式員使用,實現對資料庫中資料的操作。 
DML分成互動型DML和嵌入型DML兩類。
依據語言的層級,DML又可分成過程性DML和非過程性DML兩種。

什麼是DCL?
DCL是Data Control Language的縮寫,意為資料控制語言,是SQL語言的四大功能之一。

SQL的組成分成幾部分?
SQL主要分成四部分:
(1)資料定義。(SQL DDL)用於定義SQL模式、基本表、視圖和索引的建立和撤消操作。
(2)資料操縱。(SQL DML)資料操縱分成資料查詢和資料更新兩類。資料更新又分成插入、刪除、和修改三種操作。
(3)資料控制。包括對基本表和視圖的授權,完整性規則的描述,事務控制等內容。
(4)嵌入式SQL的使用規定。涉及到SQL語句嵌入在宿主語言程式中使用的規則。

What are the difference between DDL, DML and DCL commands? 
DDL is Data Definition Language statements. Some examples: 
CREATE - to create objects in the database 
ALTER - alters the structure of the database 
DROP - delete objects from the database 
TRUNCATE - remove all records from a table, including all spaces allocated for the records are removed 
COMMENT - add comments to the data dictionary 
GRANT - gives user‘s access privileges to database 
REVOKE - withdraw access privileges given with the GRANT command 
DML is Data Manipulation Language statements. Some examples:

SELECT - retrieve data from the a database 
INSERT - insert data into a table 
UPDATE - updates existing data within a table 
DELETE - deletes all records from a table, the space for the records remain 
CALL - call a PL/SQL or Java subprogram 
EXPLAIN PLAN - explain access path to data 
LOCK TABLE - control concurrency 
DCL is Data Control Language statements. Some examples:

COMMIT - save work done 
SAVEPOINT - identify a point in a transaction to which you can later roll back 
ROLLBACK - restore database to original since the last COMMIT 
SET TRANSACTION - Change transaction options like what rollback segment to use 。

《FROM:http://www.open-open.com/home/space-15604-do-blog-id-3322.html》

資料庫的四種語言(DDL、DML、DCL、TCL)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.