MySQL: TRUNCATE TABLE statement

Profile picture for user arilio666

TRUNCATE in MySQL deletes all the records off of a table leaving only the column names alone. Try this method over a clone table as it wipes out the records of the queried table.

Syntax

TRUNCATE TableName;

For example purpose, we will be using the shipclone table which is a copy of the shippers' table, and try to truncate it.

Here is the shipclone table:

Example

TRUNCATE shipclone;

So as we can see the following query has wiped out the records off of the shipclone table.

Tags