what is the exact difference between delete and truncate? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

what is the exact difference between delete and truncate?

20th Sep 2016, 10:38 AM
Pratik Shetty
Pratik Shetty - avatar
7 Answers
+ 7
delete will remove the data from the particular row..whereas truncate will remove all the data present in the table....for example there is a glass full of water. if we tilt the glass and drop some water it will be the delete command..now if we empty the glass it is called truncate command..and if we drop the glass it will be called the drop command which will remove the entire schema or we can say structure of the table...
28th Sep 2016, 1:29 PM
Saurabh Singh Bisht
Saurabh Singh Bisht - avatar
+ 6
1. TRUNCATE is much faster than DELETE. 2. You can't rollback in TRUNCATE, but in DELETE you can. TRUNCATE removes the record permanently. 3. Trigger doesn't get fired in case of TRUNCATE. Trigger get fired in case of DELETE. 4. You can't use conditions (WHERE) in TRUNCATE in opposition DELETE.
20th Sep 2016, 4:58 PM
Maria
+ 3
delete is used to remove data from your table & TRUNCATE is used remove all values from your table
23rd Sep 2016, 2:57 PM
Aashish Vijay Auti
Aashish Vijay Auti - avatar
+ 1
Truncate will just remove the data and keeps the schema...but delete will remove schema itself
18th Jan 2017, 8:34 AM
Manohar B
Manohar B - avatar
0
DELETE will delete columns data from tables while truncate delets the whole table (or all columns from the table )
21st Nov 2016, 3:25 AM
Arun Bhandari
Arun Bhandari - avatar
- 1
delete will delete whole table with its structure... but when you truncate structure remains same but inly values are removed
16th Oct 2016, 5:38 PM
Kunal Burangi
Kunal Burangi - avatar
- 3
I don't know exactly what to do
24th Sep 2016, 7:00 AM
Abhishek Dubey
Abhishek Dubey - avatar