What is the difference between DELETE and TRUNCATE statement in SQL?

Answer

The main differences between SQL DELETE and TRUNCATE statements are given below:

No.DELETETRUNCATE
1) DELETE is a DML command. TRUNCATE is a DDL command.
2) We can use WHERE clause in DELETE command. We cannot use WHERE clause with TRUNCATE
3) DELETE statement is used to delete a row from a table TRUNCATE statement is used to remove all the rows from a table.
4) DELETE is slower than TRUNCATE statement. TRUNCATE statement is faster than DELETE statement.
5) You can rollback data after using DELETE statement. It is not possible to rollback after using TRUNCATE statement.

All sql dba Questions

Ask your interview questions on sql-dba

Write Your comment or Questions if you want the answers on sql-dba from sql-dba Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---