MySQueaL Resources

resources for mysql admins and developers who are squealing for help

More Resources

Main Doc Pages
Privileges Required
  • DROP
Comments
MySQL columns: everywhere I look are tables and columns; life is filled with databases of information to be ordered and grouped. (Berlin, Germany)

TRUNCATE Statement

Use this MySQL 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.

hits past month: 8 ;  last updated: may 4, 2009 - 2:34am ;  parent: Data Manipulation Statements

Syntax

TRUNCATE [TABLE] table

Explanation

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.

There are no examples for this page of our documentation. Return to Data Manipulation Statements page of our MySQL Documentation