1. Home
  2. SQL
  3. MySQL Tutorial
  4. MySQL – Truncate Table

MySQL – Truncate Table

Use MySQL TRUNCATE TABLE statement to delete all table content. This doesn’t remote table structure. The truncate table also reset the auto increment values.



MySQL Truncate Table Statement

For example to remove all data from table named users use following command. You must select database first before running below command.

Example – MySQL Truncate Table

For example, I have a table named users with following records in a database. First, check the available data in the table. After that truncate table and again check.

Now execute the truncate table statement on users table.

mysql> TRUNCATE TABLE users;

After running truncate table statement, again check the table values.

mysql> SELECT * FROM users;

Empty set (0.00 sec)
Tags , ,
Was this article helpful to you? Yes 4 No 1