What is the difference between Truncate And Delete? - ProProfs Discuss
Advertisement

What is the difference between Truncate And Delete?

Asked by Jenske , Last updated: May 12, 2024

+ Answer
Request
Question menu
Vote up Vote down

3 Answers

C. Block

C. Block

Find happiness in writing new things.

C. Block
C. Block, English Professor, M.A, Ph.D, Buffalo

Answered Aug 03, 2020

One of the major differences between Truncate And Delete commands is that the former is a DDL command, while the latter is a DML command. Delete as a command is used majorly to delete specific data in the table without affecting the configuration or structure of the table. Truncate, as a command, is used to delete the entire data in the table.

When using Delete command, all you need to do is to specify the part of the table that needs to be deleted. It is capable of this function because it uses the "where clause." Since the truncate command is used to delete all data contained in a table, there is no need for the "where clause."

The Delete command works by locking the rows to be deleted first before deleting them. In the case of the truncate command, the whole table is locked, so it can be easy to delete everything at once.

upvote downvote
Reply 

C. Marcus

C. Marcus

C. Marcus
C. Marcus, Content Developer, Washington

Answered Jul 23, 2020

In data tables, there are different commands that can be used to serve different functions. Two of the many commands that data tables have are delete and truncate. One difference between the two is the type of command that it is. Delete is a DML command. Truncate is a DDL command. While both can be used to delete data, the amount of data it deletes is different.

Delete is a used when a person wants to delete a specific amount of data, while truncate is used to delete the entire amount of data. Another difference between them is the ability to rollback changes. Delete can rollback changes, while truncate can not.

upvote downvote
Reply 

F. Daniel

F. Daniel

I work for a California based MNC.

F. Daniel
F. Daniel, Content Optimization Executive, Diploma in Journalism, California

Answered Jul 21, 2020

One of the major differences between Truncate and Delete is the function of the two commands. Truncate command is used to delete a table so that you now have a table with no data. Before you can use this command, you will need to be specific about the actual table that needs to be deleted. The reason is that there could be other tables and you wouldn't want to risk all of them.

Once you have specified the name of the table, all data in its rows will be deleted. On the other hand, a delete command can also be used to delete all rows in a table, but it can as well be used to delete specified rows in a table.

If you want a particular row to be deleted, a delete command is what you should use. Before this is done, once you issue a delete command, the entire table will first be copied to the roll backspace before the specified rows are deleted.

upvote downvote
Reply 

Advertisement
Advertisement
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader

Email Sent
We have sent an email to your address "" with instructions to reset your password.