Friday, 5 August 2011

Using TRUNCATE


The TRUNCATE statement allows us to delete all the rows from a table. For example:



TRUNCATE TABLE employee;

This query would delete all the employees from the employee table. This is faster than a DELETE statement because it works by dropping the table and re-creating it empty. One thing to bear in mind is that TRUNCATE is not transaction safe.

No comments:

Post a Comment