MySQL删除数据

delete删除:

//删除test表全部数据,但自增字段(也就是表的id主键)不会归零,可以事务回滚
delete from test
//删除test表中id为2的数据
delete from test where id = 2

truncate删除:

//删除test表全部数据,自增字段归零,不可以事务回滚
truncate table test

drop删除:

//删除test表,包括表数据和结构,不可以事务回滚
drop table bub_test

三者在执行速度上:delete < truncate < drop