What is the difference between the ldquo DELETE rdquo and ldquo TRUNCATE rdquo commands SQL enables users to work with databases in a variety of ways including querying data adding updating and removing records nbsp designing and editing database schemas tables views indexes etc and managing permissions for database access In this artcle we have delete and truncate keyword is most common and usefull phase Definition of TRUNCATE command quot The TRUNCATE command can be used to nbsp remove every row from a table and free up the table 39 s space without erasing the table 39 s structure quot Syntax Truncate all rows from the quot developer quot table TRUNCATE TABLE developer Definition of Delete command quot DELETE command is used to remove one or more rows from a table based on a specified condition Here is the basic syntax of the DELETE command quot Syntax Truncate one or more rows from the quot developer quot table DELETE FROM developer WHERE condition Below is point of difference between delete and truncate 1 The DELETE command is used to remove rows from a table based on a WHERE condition whereas TRUNCATE removes all rows from a table 2 So we can use a where clause with DELETE to filter and delete specific records whereas we cannot use a Where clause with TRUNCATE 3 DELETE is executed using a row lock each row in the table is locked for deletion whereas TRUNCATE is executed using a table lock and the entire table is locked for removal of all records 4 DELETE is a DML command whereas TRUNCATE is a DDL command 5 DELETE retains the identity of the column value whereas in TRUNCATE the Identify column is reset to its seed value if the table contains any identity column 6 To use Delete you need DELETE permission on the table whereas to use Truncate on a table you need at least ALTER permission on the table 7 DELETE uses more transaction space than the TRUNCATE statement whereas Truncate uses less transaction space than DELETE statement 8 DELETE can be used with indexed views whereas TRUNCATE cannot be used with indexed views 9 The DELETE statement removes rows one at a time and records an entry in the transaction log for each deleted row whereas TRUNCATE TABLE removes the data by deallocating the data pages used to store the table data and records only the page deallocations in the transaction log 10 Delete activates a trigger because the operation is logged individually whereas TRUNCATE TABLE can 39 t activate a trigger because the operation does not log Similar SQL FAQ Question nbsp What is the difference between the quot DELETE quot and quot TRUNCATE quot commands what is the difference between the delete and truncate commands in sql what is the difference between delete drop and truncate commands describe the difference between the delete and truncate commands what is the difference between drop truncate and delete sql commands Conclusion In this article We see that while TRUNCATE is more efficient for removing all rows from a table when using the DELETE statement especially without a WHERE clause nbsp as it can lead to the loss of data It 39 s often a good practice to take a backup before performing such operations especially in a production environment We provided SQL nbsp Interview Question for learning