What are difference between DROP and TRUNCATE in SQL ?
DROP :
- The DROP command is used to remove table definition and its contents.
- In the DROP command, table space is freed from memory.
- DROP is a DDL(Data Definition Language) command.
- In the DROP command, view of table does not exist.
- In the DROP command, integrity constraints will be removed.
- In the DROP command, undo space is not used.
- The DROP command is quick to perform but gives rise to complications.
TRUNCATE :
- Whereas the TRUNCATE command is used to delete all the rows from the table.
- While the TRUNCATE command does not free the table space from memory.
- Whereas the TRUNCATE is also a DDL(Data Definition Language) command.
- While in this command, view of table exist.
- While in this command, integrity constraints will not be removed.
- While in this command, undo space is used but less than DELETE.
- While this command is faster than DROP.