Tutorialsteacher

Follow Us

SQL - TRUNCATE Table Statement

The TRUNCATE statement is used to delete all rows from a table in the database. It works the same as the DELETE statement, but you cannot use the WHERE clause with the TRUNCATE statement. The deleted rows using the TRUNCATE statement cannot be recovered. It deletes the rows permanently.

Syntax

TRUNCATE TABLE table_name;

The following command will remove all data from the Employee table in SQL Server, Oracle, MySQL, PostgreSQL databases.

SQL Script: Truncate Table Statement
TRUNCATE TABLE Employee;

The TRUNCATE command is not supported in SQLite. But alternatively, the DELETE command can be used to Delete all the data from the table.

SQL Script: Delete Rows in SQLite
DELETE FROM Employee;