Header Ads

Delete VS Truncate

I discussed earlier Difference between drop and truncate.Now let us see the Difference between Delete and truncate
Delete VS Truncate
1.The Delete command under the Data Manipulation LanguageThe Truncate command under the Data Definition Languag
2.DELETE is a command that allows the programmer to delete a single row from a table in a SQL database.The TRUNCATE command allows the programmer to delete all rows from a table in a SQL database.
3.Allows Filters o certain data.Does not allows Filters.
4.The DELETE command is executed using a row lock, where each row in the table is locked for deletionThe TRUNCATE command locks the table and page but not each row
5.Activates a trigger because the operation are logged individuallycannot activate a trigger because the operation does not log individual row deletions
6.Deletes specified data where condition existsRemoves all data in the table
7. Allows Rollback or undo optionDoes not allow rollback or undo option
8.Slower in performance as it keeps logsFaster than Delete as it does not keep logs

No comments:

Powered by Blogger.