mysql clear table data command has the following two statements:
Statement 1:
delete from 表名;
Statement 2:
truncate table 表名;
Comparison:
(1) The delete statement without where parameter can be deleted All contents in the mysql table can also be cleared using truncate table.
(2) In terms of efficiency, truncate is faster than delete, but after truncate is deleted, the mysql log is not recorded and the data cannot be recovered.
(3) The effect of delete is a bit like deleting all the records in the mysql table one by one until the deletion is complete, while truncate is equivalent to retaining the structure of the mysql table and re-creating the table. All states are equivalent to new surface.
Recommended tutorial: "MySQL Tutorial"
The above is the detailed content of What is the mysql command to clear table data?. For more information, please follow other related articles on the PHP Chinese website!