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 difference between database and server?

534


How many types of locks are present in a database?

611


Explain the table term used in database.

577


What are the types of indexes that are present inside a database?

645


What is a reference table in database?

575






First input columns brand, mt, re values are ov, 1,re vg, 2,re wu ,3,re. Second input columns are brand, mt, cx their records are ov,4,vg ,5,cx Wu, 6,cx and third input columns brand, mt, rt values are ov,7,rt vg, 8,rt wu, 9,rt but my output is brand, re, cx,rt values are ov, 1,4,7 vg, 2,5,8 wu, 3,6,9

1314


What is difference between clustered, non-clustered and unique index?

611


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

2095


Can you tell any two advantages of stored procedures?

599


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

2130


how do you do sql tuning?

1608


What is database schema name?

584


what is rcp,if rcp disabled what happen?

1718


Is hive a database?

562


Explain partial key?

660