Difference between DELETE and TRUNCATE

By j Miracle

Basic difference between delete and truncate command.

Delete command removes rows based on the criteria which we define on Where clause.

Truncate removes all the rows from the table.

Syntax for Delete:

DELETE FROM tablename WHERE column_name <op> value

ex.

DELETE FROM employee where EMPID>10

it will removes all the employee havind EMPID is greater than 10.

Syntax for TRUNCATE:

TRUNCATE TABLE tablename

ex.

TRUNCATE TABLE employee

it will remove all the records from employee table:

Similarity:

delete from employee

is similar to

truncate table employee

Difference between DELETE and TRUNCATE  (918 Views)