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

What is the Lock Based Protocol used for?

738


Should I store images in database?

673


What is the purpose of TNS?

729


What are the validations performed on the source data? If there are junk data available in the source data, how to eliminate it?

1667


Explain database partitioning.

726






A design problem was given in which I was supposed to make a design for the data base for a given problem.

637


How do database connections work?

590


What is a reference table in database?

659


WHAT IS THE PURPOSE OF TESTING INTEGRITY OF THE UNIVERSE?

1905


What is the difference between oracle and MS Access?

709


What is replicaset?

666


where can i free download sqlserver2008..i can install sqlserver2008 without visual studio 2008 and work on it

1665


1. How to test Database? Please, give me all details for "SQL,Msaccess, Mysql Database? 2.For which functionalities database used? 3.How to convert Guest to Admin by Mysql database?

1834


How concurrency problems effect the database?

717


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

2601