The SQL TRUNCATE TABLE command is used to delete complete data from an existing table. You can also use DROP TABLE command to delete complete table but it would remove complete table structure form the database and you would need to re-create this table once again if you wish you store some data.
Syntax: The basic syntax of TRUNCATE TABLE is as follows:
TRUNCATE TABLE table_name;
Example: Consider the DEPT table having the following records:
Following is the example to truncate:
TRUNCATE TABLE DEPT;
Now, DEPT table is truncated and following would be the output from SELECT statement:
SELECT * FROM DEPT; Empty set (0.00 sec)