Delete data using the Delete table statement
DELETE from < table name > [WHERE < update condition;]
DELETE from WHERE Bookcode='981267'
Issue: You cannot delete data rows that are referenced by primary key values when you use Delete to delete data.
To delete data using the TRUNCATE TABLE statement
Truncate Table < name >
Attention:
1. Truncate table Deletes only the rows of data in the table and does not delete the tables structure and various constraints.
2. Truncate table cannot delete a data table that has a referential relationship.
Truncate Table Authors -- equivalent to Delete from Authors
The difference between Delete and truncate
Delete deleted data can be recovered from the log file
Truncate table deleted data cannot be recovered
When delete is deleted, the identity column values retain the maximum value in the original use
When Truncate table is deleted, the identity column reverts to the identity seed value that was originally set
Delete Deletes data when a record is deleted.
Truncate table when you delete data, it is deleted as a data page.
Data management of database series (delete data)