In SQL, the <code>TRUNCATE TABLE</code> statement is a data manipulation language (DML) operation that deletes all rows of a table without causing a triggered action. 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, as the optional feature F200, "TRUNCATE TABLE statement".
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 <code>TRUNCATE TABLE mytable</code> statement is logically (though not physically) equivalent to the <code>DELETE FROM mytable</code> statement (without a <code>WHERE</code> clause). The following characteristics distinguish <code>TRUNCATE TABLE</code> from <code>DELETE</code>:
The SQL standard classifies TRUNCATE as a data change statement, synonymous with data manipulation (DML). This aligns with TRUNCATE being logically equivalent to an unconstrained DELETE operation.
However, some documents describe TRUNCATE as a data definition language (DDL) operation, because TRUNCATE may be seen as a combined DROP+CREATE operation.