Statements for emptying table data in mysql database
The mysql empty table data command has the following two statements:
Statement 1:
Delete from table name
Statement 2:
Truncate table table name
Compare:
(1) the delete statement without the where parameter can delete all the contents of the mysql table, and use truncate table to empty all the contents of the mysql table.
(2) truncate is faster than delete in efficiency, but mysql logs are not recorded after truncate deletion, and data cannot be recovered.
(3) the effect of delete is a bit like deleting all the records in the mysql table to the end, while truncate is equivalent to retaining the structure of the mysql table and recreating the table, and all the states are equivalent to the new table.
What is the above command for mysql to clear the table data? For more details, please pay attention to other related articles!