What is the difference between delete, drop and truncate?
TRUNCATE
- It removes all rows from a table.
- It does not require a WHERE clause.
- Truncate cannot be used with indexed views.
- It is performance wise faster.
DELETE
- It removes Some or All rows from a table.
- A WHERE clause is used to remove particular rows according to the matched condition. All rows will be deleted when we did not use Where condition in Query.
- It removes rows one by at a time.
- It can be used with indexed views.
DROP
- It removes a table from the database.
- All table's rows, indexes, and privileges will also be removed when we used this command.
- The operation cannot be rolled back.
Also Read: MongoDB Interview Questions And Answers
Suggest An Answer
No suggestions avaliable!