Diffrence Between delete and truncate

chlf2008發表於2011-02-19

SQL> select * from T2;

I2
----------
1
2

SQL> we discuss the diffrence betwween delete and truncate;

SQL> delete from t2;

2 rows deleted.

SQL> select * from T2;

no rows selected

SQL> rollback
2 ;

Rollback complete.

SQL> select * from T2;

I2
----------
1
2

SQL> we delete the data from table,we can rollback,and the data deleted will back;

SQL>
SQL> select * from T2;

I2
----------
1
2

SQL> truncate table t2;

Table truncated.

SQL> select * from T2;

no rows selected

SQL> rollback;

Rollback complete.

SQL> select * from T2;

no rows selected

SQL> we truncate a table,the data will be found never!

SQL> delete is a DML ,but truncate is a DDL;

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12262773/viewspace-1046211/,如需轉載,請註明出處,否則將追究法律責任。

相關文章