Truncate (SQL)


In SQL, the TRUNCATE TABLE statement is a Data Definition Language operation that marks the extents of a table for deallocation. The result of this operation quickly removes all data from a table, typically bypassing a number of integrity enforcing mechanisms. It was officially introduced in the standard.
TRUNCATE TABLE removes all rows from a table, but the table structure and its columns, constraints, indexes, and so on remain. To remove the table definition in addition to its data, use the DROP TABLE statement.
The TRUNCATE TABLE mytable statement is logically equivalent to the DELETE FROM mytable statement. The following characteristics distinguish TRUNCATE TABLE from DELETE: