Truncating a Table


Truncating a Table

To remove all rows from a table without deleting the table structure, use the TRUNCATE TABLE statement. This is often faster than DELETE because it doesn’t log individual row deletions.

Syntax:

TRUNCATE TABLE table_name;

Example:

TRUNCATE TABLE employees;

This removes all rows from the employees table but keeps the table structure.