What is the difference between DELETE, TRUNCATE and DROP?
| Command | Removes | WHERE? | Can be rolled back? |
|---|---|---|---|
DELETE | Chosen rows | Yes | Yes, inside a transaction |
TRUNCATE | All rows, table stays. Counter restarts | No | No |
DROP | The table (structure and data) | No | No |
DELETE FROM students WHERE id = 6;
TRUNCATE TABLE students;
DROP TABLE students;
TRUNCATE is faster than DELETE without WHERE. See DELETE and DROP TABLE.
Learn more about the similar topics:
| Tutorials |
|---|
| No Content Found. |
| Exercises & Assignments |
|---|
| No Content Found. |
| Interview Questions & Answers |
|---|
| No Content Found. |