Delete from tablename
Truncate table tablename
All records in the table can be deleted --
I used to know this command, but I don't know how it works and its performance. Today I am reading a book and posting it to share it with you.
The delete statement deletes a row from the table each time, and saves the delete operation of the row as a transaction record in the log for rollback, you can also delete views of a table.
The truncate table deletes all data pages from the table at one time and does not store the individual deletion operation records in logs. Deleting rows cannot be recovered. In addition, table-related deletion triggers are not activated during the deletion process. The number of resources used for war is relatively small, and the execution speed is fast.
In addition, truncate table can only Delete tables, but cannot delete views.