Site Owners Forums - Webmaster Forums

Site Owners Forums - Webmaster Forums (http://siteownersforums.com/index.php)
-   PHP / mySQL (http://siteownersforums.com/forumdisplay.php?f=10)
-   -   What is the difference between DELETE and TRUNCATE statement in SQL? (http://siteownersforums.com/showthread.php?t=357573)

Pavan Techn 06-01-2018 10:16 AM

What is the difference between DELETE and TRUNCATE statement in SQL?
 
The main differences between SQL DELETE and TRUNCATE statements are given below:

No. DELETE TRUNCATE
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.

Kumkum 03-13-2021 07:07 AM

This is very helpful information, thanks for it.
I have also learn other SQL statements from here.


All times are GMT -7. The time now is 01:48 PM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.