DELETE:
The DELETE command is used to delete the specific rows or delete all rows from a table with or without using WHERE clause. It contains WHERE clause if required.
The DELETE command doesn't reseeds Identity values.
It is a DML or Data Manipulation Language command.
We can Rollback the data or get the data back after using the DELETE command.
The DELETE command is slower than TRUNCATE command.
The example of DELETE command is as below:
DELETE FROM EMPLOYEE WHERE ID = 1
OR
DELETE * FROM EMPLOYEE
Here, we are deleting the record from Employee table whose ID = 1. You can see the below screenshot for further clarifications.
TRUNCATE:
The TRUNCATE command is used to delete all the rows or records from a table without using WHERE clause. There is no any need of WHERE clause while use TRUNCATE command.
The TRUNCATE command reseeds Identity values.
It is a DDL or Data Definition Language command.
We can't Rollback the data or get the data back after using the TRUNCATE command.
The TRUNCATE command is faster than DELETE command.
The example of TRUNCATE command is as below:
TRUNCATE TABLE EMPLOYEE
Here, we are deleting all the records from Employee table by using TRUNCATE command. You can see the below screenshot for further clarifications.
- - - - - - Cheers, Happy to Help! - - - - - -
No comments:
Post a Comment