Name

TRUNCATE TABLE

Synopsis

TRUNCATE TABLE table

Use this statement to delete the contents of a table rapidly. This statement is similar to the DELETE statement in that it will delete all of the data contained in a given table. Its method is to delete the table and then to re-create the table, but without data. As a result, this statement is faster than using DELETE. However, the TRUNCATE statement does not report the number of rows deleted. Another minor drawback to this statement is that the value for an AUTO_INCREMENT column will be lost along with the data.

Get MySQL in a Nutshell 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.