The TRUNCATE TABLE command is used to remove the all rows from an existing table.
TRUNCATE TABLE tableName;
TRUNCATE TABLE EMPLOYEE;
Difference between TRUNCATE, DELETE and DROP commands:
The DELETE statement is used to delete or remove all the rows from the table. We can use where clause to delete some specific rows. We can roll back the DELETE operation. DELETE is slower than TRUCATE. It is a DML command. Table structure will not be lost.
The TRUNCATE statement is used to remove the all rows from an existing table. We can’t roll back the TRUNCATE operation. TRUCATE is faster than DELETE. It is a DDL command. Table structure will not be lost.
The DROP TABLE statement is used to delete an existing table definition, indexes, constraints, access privileges and all associated data. We can’t roll back the DROP operation. It is DDL command. Table structure will be lost.