Difference between truncate and delete? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Difference between truncate and delete?

when we are delete a table, we can perform rollback. where as truncate we can't rollback.

17th Dec 2016, 5:36 PM
Thurlu karunakar
Thurlu karunakar - avatar
2 Réponses
+ 2
truncate is a ddl command it means it used to define. you can not rollback it because it does not keep any logs and does not lock . also you can not use where clause or fire a trigger in case of truncate. any auto increments will be reset after truncate. otherhand delete is a dml statement and can be rolled back. another command is drop to drop the schema IMG with data.
18th Dec 2016, 3:34 AM
Shekhar Bahuguna
Shekhar Bahuguna - avatar
0
Delete gives an optional where clause to identify rows to be deleted. On the other hand truncate will delete all rows on the specified table.
18th Dec 2016, 7:58 AM
Doni
Doni - avatar