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

What is the relationship that exists inside in E-R diagram?

627


On startup, the transaction log of a database has filled and recovery has suspended, what can I do?

544


What is the difference between oracle and MS Access?

610


What is the function of cluster index?

608


Is storing images in a database a good idea?

540






What is a database lookup?

564


Explain the field term used in database.

542


Design an ETL process( batch job/script)from source to starting that u will not be dependent on the source in the near future?please elobarate details on what are things to consider.if you'd like to do a diagram that will be great.please answer it

1690


What advantages does DBMS have over traditional file systems?

585


How concurrency problems effect the database?

625


Given a table Employee which has columns name and salary, write an SQL query to find the employee with the second highest salary.

582


Which is the most reliable programming language for RDBMS Relational Database Management System for Multi user applicaton. For PC application or web application ?

2023


What is a database example?

530


Which three commands cause a transaction to end?

589


Which database is best to store images?

519