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
What is the difference between database and server?
How many types of locks are present in a database?
Explain the table term used in database.
What are the types of indexes that are present inside a database?
What is a reference table in database?
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
What is difference between clustered, non-clustered and unique index?
What is the DIF format and when we will use in teradata
Can you tell any two advantages of stored procedures?
How to do Data size testing? Who does this testing (Developer or tester)?
how do you do sql tuning?
What is database schema name?
what is rcp,if rcp disabled what happen?
Is hive a database?
Explain partial key?