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
Explain phantom deadlock?
What is a database call?
What is the best database?
can i use the commands "modify" and Change in DB2 to alter my column datatype and its name in a table?
Please post the scenerois for writing the complex sql queries , for my practice.Can be any query if you cannot solve.
what is the full procedure for using store procedure in informatica7.1?
Differentiate between unique key and foreign key?
What is ole db source in ssis?
What is meant by distributed system?
HOW PASS PARAMETERS FOLLOWING ORDER RPG-CL-RPG?
Can you tell any two advantages of stored procedures?
What is redis good for?
List various types of log-based recovery in DBMS.
What is a Transformation?
What happens when shared and exclusive locks are applied on data item?