posts - 495,  comments - 11,  trackbacks - 0

          DML(data manipulation language):
          ?????? 它們是SELECT、UPDATE、INSERT、DELETE,就象它的名字一樣,這4條命令是用來對數(shù)據(jù)庫里的數(shù)據(jù)進行操作的語言
          DDL(data definition language):
          ?????? DDL比DML要多,主要的命令有CREATE、ALTER、DROP等,DDL主要是用在定義或改變表(TABLE)的結構,數(shù)據(jù)類型,表之間的鏈接和約束等初始化工作上,他們大多在建立表時使用
          DCL(Data Control Language):
          ?????? 是數(shù)據(jù)庫控制功能。是用來設置或更改數(shù)據(jù)庫用戶或角色權限的語句,包括(grant,deny,revoke等)語句。在默認狀態(tài)下,只有sysadmin,dbcreator,db_owner或db_securityadmin等人員才有權力執(zhí)行DCL

          詳細解釋:
          一、DDL is Data Definition Language statements. Some examples:數(shù)據(jù)定義語言,用于定義和管理 SQL 數(shù)據(jù)庫中的所有對象的語言
          ????? 1.CREATE - to create objects in the database?? 創(chuàng)建
          ????? 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]。
            下面是對Truncate語句在MSSQLServer2000中用法和原理的說明:
            Truncate table 表名 速度快,而且效率高,因為:
            TRUNCATE TABLE 在功能上與不帶 WHERE 子句的 DELETE 語句相同:二者均刪除表中的全部行。但 TRUNCATE TABLE 比 DELETE 速度快,且使用的系統(tǒng)和事務日志資源少。
            DELETE 語句每次刪除一行,并在事務日志中為所刪除的每行記錄一項。TRUNCATE TABLE 通過釋放存儲表數(shù)據(jù)所用的數(shù)據(jù)頁來刪除數(shù)據(jù),并且只在事務日志中記錄頁的釋放。
            TRUNCATE TABLE 刪除表中的所有行,但表結構及其列、約束、索引等保持不變。新行標識所用的計數(shù)值重置為該列的種子。如果想保留標識計數(shù)值,請改用 DELETE。如果要刪除表定義及其數(shù)據(jù),請使用 DROP TABLE 語句。
            對于由 FOREIGN KEY 約束引用的表,不能使用 TRUNCATE TABLE,而應使用不帶 WHERE 子句的 DELETE 語句。由于 TRUNCATE TABLE 不記錄在日志中,所以它不能激活觸發(fā)器。
            TRUNCATE TABLE 不能用于參與了索引視圖的表。
          ?????? 5.COMMENT - add comments to the data dictionary 注釋
          ?????? 6.GRANT - gives user's access privileges to database 授權
          ?????? 7.REVOKE - withdraw access privileges given with the GRANT command?? 收回已經(jīng)授予的權限

          二、DML is Data Manipulation Language statements. Some examples:數(shù)據(jù)操作語言,SQL中處理數(shù)據(jù)等操作統(tǒng)稱為數(shù)據(jù)操縱語言
          ?????? 1.SELECT - retrieve data from the a database?????????? 查詢
          ?????? 2.INSERT - insert data into a table??????????????????? 添加
          ?????? 3.UPDATE - updates existing data within a table??? 更新
          ?????? 4.DELETE - deletes all records from a table, the space for the records remain?? 刪除
          ?????? 5.CALL - call a PL/SQL or Java subprogram
          ?????? 6.EXPLAIN PLAN - explain access path to data
          ?????? Oracle RDBMS執(zhí)行每一條SQL語句,都必須經(jīng)過Oracle優(yōu)化器的評估。所以,了解優(yōu)化器是如何選擇(搜索)路徑以及索引是如何被使用的,對優(yōu)化SQL語句有很大的幫助。Explain可以用來迅速方便地查出對于給定SQL語句中的查詢數(shù)據(jù)是如何得到的即搜索路徑(我們通常稱為Access Path)。從而使我們選擇最優(yōu)的查詢方式達到最大的優(yōu)化效果。
          ?????? 7.LOCK TABLE - control concurrency 鎖,用于控制并發(fā)

          三、DCL is Data Control Language statements. Some examples:數(shù)據(jù)控制語言,用來授予或回收訪問數(shù)據(jù)庫的某種特權,并控制數(shù)據(jù)庫操縱事務發(fā)生的時間及效果,對數(shù)據(jù)庫實行監(jiān)視等
          ?????? 1.COMMIT - save work done 提交
          ?????? 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 options like what rollback segment to use?? 設置當前事務的特性,它對后面的事務沒有影響.


          posted on 2011-08-17 19:40 jadmin 閱讀(113) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導航:
           
          主站蜘蛛池模板: 修水县| 济阳县| 庆城县| 宁河县| 梅河口市| 长治县| 邵东县| 泽普县| 江源县| 夏津县| 楚雄市| 沙坪坝区| 察雅县| 雅安市| 崇左市| 吉安市| 津市市| 乐平市| 太仆寺旗| 沂源县| 高邑县| 牟定县| 古田县| 江孜县| 惠安县| 吉木萨尔县| 阳山县| 德惠市| 鹤山市| 定兴县| 霞浦县| 吉木萨尔县| 雷州市| 治多县| 阿城市| 霍林郭勒市| 鹤峰县| 东阿县| 永安市| 望江县| 浙江省|