Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

truncate
delete
sql

Truncate vs. Delete

Educative Answers Team

Truncate and Delete are the two commands used to delete a table’s data in SQL. Both of these commands are used for the same purpose, ​but there is still a slight difference between them.

svg viewer

Main differences

Truncate Delete
Truncate typically resets the identity of a particular table. Delete only deletes the data​ and does not reset the identity of the table.
Truncate comes with the word TABLE. Delete comes with the word FROM.
Truncate is a data definition language (DDL) command. Delete is a data manipulation language (DML) command.
Truncate does not maintain a log; hence, it is fast. Delete maintains a log; hence, it is slow.

Syntax

Suppose that the table Educative needs to be deleted from the SQL.

Truncate

Truncate TABLE Educative

Delete

Delete FROM Educative

RELATED TAGS

truncate
delete
sql
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring