drop : This table is no longer needed;
TRUNCATE : retention of the table, but you want to delete all records;
the Delete : To delete a part of the record or there might regret, then use delete;
1. drop table tb;
drop directly to the table is deleted and can not be retrieved. Such as deleting user table:
drop table user;
2. truncate (table) tb;
truncate table is to delete all the data, but can not be used with where;
TRUNCATE TABLE user;
3. delete from tb (where);
delete also delete the data in the table, but can be used in conjunction with where to delete a particular row;
- delete all data in
the Delete from the User;
- delete the specified line
delete from user where username = 'Tom ';
Bulk Action:
1, execute the following statement to obtain delete statement
drop:
SELECT CONCAT('drop table ',table_name,';') FROM information_schema.`TABLES` WHERE table_schema='数据库名';
truncate:
SELECT CONCAT('TRUNCATE table ',table_name,';') FROM information_schema.`TABLES` WHERE table_schema='数据库名';
delete:
SELECT CONCAT('delete from ',table_name,';') FROM information_schema.`TABLES` WHERE table_schema='数据库名';
2, a copy of the statement, and then execute