statement

TRUNCATE TABLE

Removes all rows while retaining the table definition; locking and transaction behavior vary by engine. PostgreSQL rejects some foreign-key dependencies unless handled explicitly. Example target: PostgreSQL 17. Use only the isolated starter dataset; setup and expected results are in the batch evidence.

Formal Syntax & Structure

sql syntaxsql
TRUNCATE TABLE name

Working Example

Example Snippetsql
CREATE TABLE scratch(id INTEGER); INSERT INTO scratch VALUES (1);TRUNCATE TABLE scratch;
SQL Reference