Introduction
The TRUNCATE statement is used for removing all records from a table. The TRUNCATE statement is not a logged transaction. The TRUNCATE Statement has a simple syntax:
Example
In this example we will assume that the 'Employees' table contains the follow columns: 'Name', 'Position', 'Office' and 'Salary'.
SELECT *
FROM Employees
Here is a sample resultset from the above SELECT query:
| Name | Position | Office | Salary |
| Joe Grape | Manager | Houston | 80000 |
| John Plum | Software Developer | Houston | 65000 |
| Frank Apple | Software Developer | Cleveland | 62000 |
| Patty Pineapple | Software Developer | Cleveland | 60000 |
| Judy Peach | Software Developer | Boston | 50000 |
| Jane Orange | Project Manager | Houston | 75000 |
We'll use the TRUNCATE statement to remove all the records from the table.
TRUNCATE TABLE Employees
Now we'll try to query the table again. We will find out that there are no longer any rows in the table.
SELECT *
FROM Employees
| Name | Position | Office | Salary |
| No Records |
|