What's the difference between DELETE and TRUNCATE | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

What's the difference between DELETE and TRUNCATE

15th Oct 2017, 11:08 AM
ULLAS U
ULLAS U - avatar
4 Réponses
+ 4
Truncate makes the table empty Delete deletes the table Edit: Delete deletes the specific record from table
15th Oct 2017, 12:56 PM
Kartikey Sahu
Kartikey Sahu - avatar
+ 1
There is none, if you do not add a WHERE to your DELETE. What Khartikey says is wrong.
15th Oct 2017, 5:10 PM
1of3
1of3 - avatar
+ 1
@1of3 I'm not talking about the syntax of DELETE i.e. DELETE * FROM table or DELETE FROM table WHERE name = value I'm just talking about what they actually do. My mistake is that I forgot to add "records" in 2 line
15th Oct 2017, 5:15 PM
Kartikey Sahu
Kartikey Sahu - avatar
0
TRUNCATE TABLE (Transact-SQL) Removes all rows from a table or specified partitions of a table, without logging the individual row deletions. TRUNCATE TABLE is similar to the DELETE statement with no WHERE clause; however, TRUNCATE TABLE is faster and uses fewer system and transaction log resources. From: https://tinyurl.com/y7phf3k8
15th Oct 2017, 11:41 PM
Joan Rodriguez
Joan Rodriguez - avatar