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 ?    8 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of graph database?

642


how to send multiple records which matches all the condition in the lookup transformation ? (if lookup matches the codition for duplicate values)

1694


What is ole db source in ssis?

637


Please post the scenerois for writing the complex sql queries , for my practice.Can be any query if you cannot solve.

2171


WHAT IS NEED BY METION DATFMT AND TIMFMT IN H-SEPICITION IN RPGLE?

2561






Explain buffer manager?

624


How heap is implemented in database?

722


List the properties of a transaction.

714


WHAT IS THE PURPOSE OF TESTING INTEGRITY OF THE UNIVERSE?

1902


What is odm in database?

653


Given a table of Player which contains Sno and player name, write a query which finds all possible Table Tennis doubles pairings.

1002


What is database bounce?

692


what are wrappers and build ups and what it's use?

1790


What is a database string?

600


How do you connect to a database?

722