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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the role of auditor in auditing data oriented applications?

1936


How concurrency problems effect the database?

639


Differentiate between extension & intension?

879


Explain partial key?

659


What is the use of graph database?

554






what is rcp,if rcp disabled what happen?

1717


What is the database url?

558


how do you do sql tuning?

1607


Can we use redis as database?

548


What do you mean by foreign key and primary key?

629


can any one tell me how i can start database testing mean what should be initial point and how i can write a query for listing page of any item thanks in advance

2107


How to implement database security?

539


Explain inner and outer joins with examples.

717


wHat Is THE difference between MOVEL and MOVEL(P)……….. CAN ANYONE EXPLAIN ME..

2508


How does non-cluster index functions?

654