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

Under which circumstance should you create an index on a table?

861


What is a database lookup?

783


What is the difference between data source and database?

738


Does facebook use graph database?

782


What is redis good for?

737


What is ole db used for?

767


how can we view column head in first page but not in remaining pages?

1808


if i want to display the name of students such that to which city they belong must have count greaer than two

1968


Explain the record term used in database.

841


Explain data independence & its types.

779


What does currency type mean in database?

889


There are three servers are run by Oracle, MS Access and .Net. What are the procedure fetching the values of two variables from two servers among these?

1890


How to do Data size testing? Who does this testing (Developer or tester)?

2317


How heap is implemented in database?

857


issues involved in modeling and building data werahouses

1724