what is difference between delete and truncet ?

Answer Posted / shivaleela

DELETE:-

1.it is a DML stmt
2.it can include WHERE condition
3.it is only delete, so it can be rolled back can be ROLL
BACK

TRUNCATE:-

1.it is a DDL stmt
2.it can not include WHERE cnd
3.it is delete+commit ,so we cant roll back can not be ROLL
BACK


Both commands accomplish identical tasks (removing all data
from a table), but TRUNCATE is much faster

Reason:When you type DELETE.all the data get copied into
the Rollback Tablespace first.then delete operation get
performed.Thatswhy when you type ROLLBACK after deleting a
table ,you can get back the data(The system get it for you
from the Rollback Tablespace).All this process take
time.But when you type TRUNCATE,it removes data directly
without copying it into the Rollback Tablespace.Thatswhy
TRUNCATE is faster.Once you Truncate you cann't get back
the data.

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which database is best to store images?

517


Explain entity type?

618


What is table scan and index scan?

603


How do you connect to a database?

592


What is the relationship that exists inside in E-R diagram?

625






What is a database connection string?

572


5. Explain about relational algebra.

1721


What is lagging in DBMS ?

802


What is the difference between primary and candidate key?

563


What is the database url?

543


I have single column in a file. Input 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 my output is file 1 have 1,2,3,10,11,12 file 2 have 4,5,6,13,14,15 and file 3 have 7,8,9 how is it possible in datastage

1180


Explain natural key?

608


Explain the record term used in database.

654


What is the DIF format and when we will use in teradata

2078


How is image stored in database?

571