Home  >  Article  >  Database  >  驱除mysql表中数据

驱除mysql表中数据

WBOY
WBOYOriginal
2016-06-07 16:24:411016browse

清除mysql表中数据 delete from ? 表名 ; truncate table ? 表名 ; 不带 where 参数的 delete 语句可以删除 mysql 表中所有内容,使用 truncate table 也可以清空 mysql 表中所有内容。 效率上 truncate 比 delete 快,但 truncate 删除后不记录 mysql 日志,

清除mysql表中数据

delete from?表名;

truncate table?表名;

不带where参数的delete语句可以删除mysql表中所有内容,使用truncate table也可以清空mysql表中所有内容。

效率上truncatedelete快,但truncate删除后不记录mysql日志,不可以恢复数据。

delete的效果有点像将mysql表中所有记录一条一条删除到删完,

truncate相当于保留mysql表的结构,重新创建了这个表,所有的状态都相当于新表。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn