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
What is the best database?
Explain transaction manager?
Data structure used to implements a menu:
Which is the best graph database?
What is ase database?
i have windows-xp processor with P4 system. whenever I tried to download foxpro for windows 2.6 on windows XP, my operating system failed to install foxpro for windows 2.6.please. how could i download , install & run foxpro for windows 2.6 easily on windows XP ?
How to implement database security?
What is ole db provider for sql server?
Explain artificial key?
how to reject duplicates in source sequential file and if by filter option then where is that filter option in the sequential file.
Given a table Employee which has columns name and salary, write an SQL query to find the employee with the second highest salary.
What is the difference between primary key, foreign key and candidate key?
what is ad-hoc access? what is the diff b/w managed query and ad-hoc access?
On startup, the transaction log of a database has filled and recovery has suspended, what can I do?
What is difference between clustered, non-clustered and unique index?