Mysql delete operation on the table

mysql table delete operation can be divided into two, the first is to delete all the data in the table, of course, that there is a deleted data satisfies a certain condition.
The first: to delete all the data.
delete from table name;
truncate table table name;
the Delete statement with no arguments where you can delete all the content mysql table, use truncate table mysql table can also be empty of all content.
Truncate efficiency faster than the delete, mysql but does not record truncate the log after deletion, can not recover the data.
delete the effect a bit like all the records in a mysql table delete to delete a finish,
but truncate the equivalent retention structures mysql table, re-create this table, all states are equivalent to the new table.

Second. Data Delete meet a certain condition
delete from table where conditions Here is an example of itWrite pictures described here

Published 69 original articles · won praise 25 · views 20000 +

Guess you like

Origin blog.csdn.net/qq_40985788/article/details/82656021