programplug Logo



SQL Truncate

TRUNCATE TABLE IN SQL



Truncate table in SQL is used to remove all the rows from a table. It is similar to DELETE command but in truncate there is no where clause is used.
Here is the Syntax:
TRUNCATE TABLE table_name;
EXAMPLE:

TRUNCATE TABLE EMPLYOEE
TRUNCATE TABLE STUDENTS;  
							

Remember:

In truncate the process of rollback is not possible after the truncate table statement.Once you use the truncate command you can not retrive the content of the table.

DIFFERENCE BETWEEN DROP TABLE AND TRUNCATE TABLE

  • Drop table command is used to delete the table completely and it also delete table of the structure.
  • TRUNCATE table doesn't delete the structure of the table.