truncate in postgresql code example

Example 1: restart identity cascade

TRUNCATE <table_name> RESTART IDENTITY CASCADE;
--RESTART will reset the identity sequence
--CASCADE all tables that have a foreign key reference to 
--table_name will be truncated as well

Example 2: truncate table postgres

TRUNCATE TABLE table_name;

Example 3: truncate table postgres

truncate my_table restart identity

Example 4: postgres clear table

TRUNCATE [ TABLE ] [ ONLY ] name [ * ] [, ... ]
    [ RESTART IDENTITY | CONTINUE IDENTITY ] [ CASCADE | RESTRICT ]

Tags:

Css Example