Empties a table of all rows.
TRUNCATE [TABLE] <name> [, ...] [CASCADE | RESTRICT]
TRUNCATE
quickly removes all rows from a table or set of tables. It has the same effect as an unqualified DELETE on each table, but since it does not actually scan the tables it is faster. This is most useful on large tables.
You must have the TRUNCATE
privilege on the table to truncate table rows.
TRUNCATE
will not run any user-defined ON DELETE
triggers that might exist for the tables.
TRUNCATE
will not truncate any tables that inherit from the named table. Only the named table is truncated, not its child tables.
TRUNCATE
will not truncate any sub-tables of a partitioned table. If you specify a sub-table of a partitioned table, TRUNCATE
will not remove rows from the sub-table and its child tables.
Empty the table films
:
TRUNCATE films;
There is no TRUNCATE
command in the SQL standard.
Parent topic: SQL Command Reference