Name
TRUNCATE
Synopsis
TRUNCATE [TABLE] table
Use this statement to delete the contents of a table
rapidly. It’s similar to the DELETE statement
in that it will delete all of the data contained in a given table. The
TRUNCATE
statement does its job by dropping the
table and then recreating it without data. As a result, it does not
report the number of rows deleted. Another drawback is that the value
for an AUTO_INCREMENT
column will be lost along
with the data. The statement does preserve file partitions and
partition parameters if the table was originally partitioned.
This statement is not transaction-safe. As of version 5.1.16 of
MySQL, DROP
privileges are required for this
statement. Previously, DELETE
privileges were
required.
Get MySQL in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.