← BYTES
Database·Starter·Ref: 13.1.11
What is the key difference between DELETE and TRUNCATE for removing rows from a table?
Have a question about this video? Mention reference 13.1.11 when you contact us.
a.They are functionally identical with no real difference
b.DELETE always removes the entire table structure, not just its rows
c.TRUNCATE can only be used on empty tables
d.DELETE removes rows one at a time (optionally with a WHERE clause to remove only some rows) and can be rolled back as part of a transaction; TRUNCATE removes ALL rows at once, is typically faster, and in some engines cannot be rolled back or bypasses certain logging
DELETE is a row-by-row operation that respects a WHERE clause and participates fully in transactional rollback/logging; TRUNCATE is a faster, coarser operation that removes every row at once (no selective WHERE clause) and, in many engines, uses less transaction-log overhead -- sometimes at the cost of being non-transactional or harder to roll back, depending on the specific database.
Find this on YouTube & Instagram
Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:
#BYTES#BYTES13111#Database