TRUNCATE
Description
Grammar Syntax
TRUNCATE [ TABLE ] [ ONLY ] name [ * ] [, ... ] [ RESTART IDENTITY | CONTINUE IDENTITY ] [ CASCADE | RESTRICT ]
Sample codes scenarios
Basic use without options
-- TABLE without descendants
TRUNCATE TABLE mytable;
-- TABLE with descendants
TRUNCATE TABLE table_with_descendants;-- TABLE without descendants
TRUNCATE mytable;
-- TABLE with descendants
TRUNCATE descendant_table;
TRUNCATE table_with_descendants;
Using ONLY Option
Without table keyword
For a list of multiple tables
Using explicit `*` include descendants
Only option should apply to the first specified table when using lists
Use RESTART OPTION for tables
Use CONTINUE OPTION for tables
Use CASCADE for tables
Use RESTRICTED for tables
Last updated
Was this helpful?