+ 10
What is the difference between DELETE & TRUNCATE ?
9 Answers
+ 42
<^> with DELETE, you can remove a specific row, and undo the delete action when it triggers you to:
while TRUNCATE only allows deletion of the WHOLE row, and the delete query cannot be undone, since it doesn't trigger you to!<^>
+ 4
The 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.
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.
+ 3
delete, remove a row with possibility to restore it. but if we use truncate there is no possibility to restore it.
+ 2
delete is used to delete all the entries in a table. but truncate is used to clear the settings of the table like constraints primary key
+ 1
< When you use DELETE it only delete that row and you can not start primary key as form start "1 " but if you TRUNCATE table than it delete all of row and this primary key will start form 1..
This is the deference. />
+ 1
delete keyword is used to specific row and truncate keyword is used to delete all rows without table structure
+ 1
also the truncate command is faster than delete
0
delete elimina "x" registros de una tabla pero lo almacena en un contenedor que es como una papelera con la finalidad de poder recuperarlos mĂĄs adelante en cambio truncate elimina todos los registros de una tabla y lo elimina sin dejar rastro. Es por eso que es mejor utilizar delete en vez de truncate.
0
Hi