Computer Science for IGCSE & O level - Databases (Section 4 - No. 19)

What is the difference between `TRUNCATE` and `DELETE` statements?
TRUNCATE is faster and removes all rows, while DELETE is slower and removes specific rows.
TRUNCATE removes specific rows, while DELETE removes all rows.
TRUNCATE is used to add data, while DELETE is used to modify data.
There is no difference; they perform the same function.

Explanation

TRUNCATE is generally faster and removes all rows in a table, resetting the auto-incrementing ID. DELETE removes specified rows based on a WHERE clause, or all rows if no WHERE clause is specified.

Comments (0)

Advertisement