+ 5

what is the difference between delete and truncate commands?

in simple words

24th Jan 2017, 1:53 AM
Avnish Tomar (CCS University)
Avnish Tomar (CCS University) - avatar
5 Respostas
+ 9
TRUNCATE is DDL command . it is used to remove All rows in the table where as DELETE command is DML command. it is used to remove specific rows in the table
24th Jan 2017, 3:25 AM
sonali
sonali - avatar
+ 3
TRUNCATE Removes all rows from a table. The operation cannot be rolled back and no triggers will be fired. As such, TRUCATE is faster and doesn't use as much undo space as a DELETE. DELETE Command is used to remove rows from a table. A WHERE clause can be used to only remove some rows. If no WHERE condition is specified, all rows will be removed. After performing a DELETE operation, you need to COMMIT or ROLLBACK the transaction to make the change permanent or to undo it. Note that this operation will cause all DELETE triggers on the table to fire.
24th Jan 2017, 3:31 AM
Sai Kiran Rayapureddy
Sai Kiran Rayapureddy - avatar
+ 2
delete and truncate comments similar but some different delete command remove rows one bye one it take time for large databases and truncate command remove structure of that table and create a new structure of that table
27th Jan 2017, 3:20 AM
kamlesh parmar
kamlesh parmar - avatar
+ 1
and in addition of @sonali madam :) : after delete you can use commit and rollback but that's not case with truncate.
1st Mar 2017, 8:00 PM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
0
truncate releases the storage space immediately, whereas delete will only remove the records , but the space used by deleted records cannot be utilised until table is defragmented or rebuild
5th Mar 2017, 9:45 AM
mahendra k
mahendra k - avatar