SQL TRUNCATE TABLE

Last Updated : 20 Aug, 2026

The TRUNCATE TABLE statement is used to remove all records from a table while preserving its structure. It is especially useful when working with large tables.

  • Executes faster than DELETE because it does not log individual row deletions.
  • In most databases, the operation cannot be rolled back once executed.

Syntax

TRUNCATE TABLE table_name;

Example: First, we will create a demo SQL database and table, on which we will use the TRUNCATE TABLE command.

Screenshot-2026-02-06-144952
Student Table

Query:

TRUNCATE TABLE students;

Output:

56

Working

Here we will look at different examples of the SQL TRUNCATE TABLE command. Consider the employee table below for the following example:

57

Query:

TRUNCATE TABLE employee;
SELECT * FROM employee;

Output:

58
  • After truncating the table, all records are removed while the table structure remains intact.
  • Executing SELECT * FROM EMPLOYEE will return an empty result set since all data has been erased.

To better understand when to use TRUNCATE, see our detailed explanation of the differences between TRUNCATE, DELETE and DROP commands.

Comment