+ 10

What is the difference between DELETE & TRUNCATE ?

18th Jan 2017, 4:09 AM
Jenny Lance
Jenny Lance - avatar
9 Respostas
+ 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!<^>
18th Jan 2017, 5:10 AM
<^>washika D<^>
<^>washika D<^> - avatar
+ 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.
18th Jan 2017, 7:32 AM
R4xx4r
R4xx4r - avatar
+ 3
delete, remove a row with possibility to restore it. but if we use truncate there is no possibility to restore it.
20th Jan 2017, 7:16 AM
Mamadou Saliou Diallo
Mamadou Saliou Diallo - avatar
+ 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
18th Jan 2017, 7:14 AM
Vishnu Sivan
Vishnu Sivan - avatar
+ 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. />
18th Jan 2017, 6:54 AM
Code Hunter
Code Hunter - avatar
+ 1
delete keyword is used to specific row and truncate keyword is used to delete all rows without table structure
4th May 2017, 5:31 AM
Bharathwaj NR
Bharathwaj NR - avatar
+ 1
also the truncate command is faster than delete
9th Jun 2017, 7:08 PM
polinoma polinoma
polinoma polinoma - avatar
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.
20th Jun 2018, 10:44 PM
Yadira
Yadira - avatar
0
Hi
15th Apr 2019, 1:11 PM
Hasin Rajitha