Question:
TRUNCATE TABLE EMP; DELETE FROM EMP; Will the outputs of the above two commands differ?
Answer:
Both will result in deleting all the rows in the table EMP.. Source: CoolInterview.com
A delete statement deletes all records in the table, but it does not free any space. A Truncate statement frees the space as well. However, a truncate can not be rolled back but delete can be rolled back. Source: CoolInterview.com
Answered by: Kokila | Date: 9/3/2007 12:42:06 PM
| Contact Kokila
We can't use WHERE clause with TRUNCATE. TRUNCATE is faster compared to DELETE. Source: CoolInterview.com
Answered by: Cyber | Date: 2/19/2009
| Contact Cyber
Here truncate is DDL commond and delete is DML commond,More over Truncate deletes all records including spaces also but its not in delete,means only records will be deleting with delete commond. Source: CoolInterview.com
Answered by: DurgaGaneshReddy.Avula | Date: 4/20/2009
| Contact DurgaGaneshReddy.Avula
Delete :- It is use to delete the rows from the table.
Truncate:- It will delete the whole table. Source: CoolInterview.com
Answered by: Archana sahu | Date: 11/11/2009
| Contact Archana sahu
TRUNCATE is more fastre than DELETE. Source: CoolInterview.com
Answered by: Devraj | Date: 11/12/2009
| Contact Devraj
using delete o/p is no.of rows are deleted
using turncate o/p table is deleted Source: CoolInterview.com
Answered by: hussain reddy | Date: 4/30/2010
| Contact hussain reddy
Delete may used with where clause set condition to delete specified rows in a table. but it not possible with truncate Source: CoolInterview.com
Answered by: Rajkumar | Date: 5/24/2010
| Contact Rajkumar
truncate is DDL statement and hence after executing this database goes into consistent sate and you no need to fire COMMIT.but,delete is DML statement and hence after executing this database does not go into consistent sate and you need to fire COMMIT to make it consistent.otherwise set AUTOCOMMIT ON Source: CoolInterview.com
Answered by: nikhil athavale | Date: 8/18/2010
| Contact nikhil athavale
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|