SQL TRUNCATE TABLE Statement
SQL TRUNCATE statement is used to delete all data from a table without a WHERE clause. The logic inside SQL TRUNCATE statement is that: SQL TRUNCATE statement drops the table and recreate it again. This way is much faster than deleting rows one by one in some RDBMSs. The syntax of SQL TRUNCATE statement is:
TRUNCATE TABLE {table_name}
Here is an example of using SQL TRUNCATE statement to delete all records in employees table:
TRUNCATE TABLE employees
The main limitation of SQL TRUNCATE statement is that you cannot use it on a table which referenced by an enabled foreign key constraint. In some RDBMSs, truncate operations are not not transaction safe so be careful when using SQL TRUNCATE statement in the online working database.