oracle 刪除資料,oracle刪除

來源:互聯網
上載者:User

oracle 刪除資料,oracle刪除

Oracle在表中刪除資料的文法是:

文法結構:

DELETE FROM表名 WHERE 條件


代碼示範:

SQL> DELETE FROM INFOS WHERE STUID='s100103'; 1 ROW DELETED SQL> COMMIT;


TRUNCATE

在資料庫操作中, TRUNCATE命令(是一個DDL命令)可以把表中的所有資料一次性全部刪除,文法是:

文法結構:

TRUNCATE TABLE 表名


TRUNCATE和DELETE都能把表中的資料全部刪除,他們的區別是:
1、TRUNCATE是DDL命令,刪除的資料不能恢複;DELETE命令是DML命令,刪除後的資料可以通過記錄檔恢複。
2、如果一個表中資料記錄很多,TRUNCATE相對DELETE速度快。

由於TRUNCATE命令比較危險,因此在實際開發中,TRUNCATE命令慎用。

 

相關文章

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.