Name
TRUNCATE
Synopsis
TRUNCATE [TABLE] tableUse 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.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access