To Differentiate between DELETE, DROP, and TRUNCATE Command in Oracle let's consider a Table named Difference as shown below:
Mark up the points shown below in the table:
CHARACTERISTICS | DELETE | DROP | TRUNCATE |
Command | This is DML Command | This is DDL Command | This is DDL Command |
Function | Delete all values in table row by row | Delete the entire Schema | Delete all the values in a table at a single go. |
Syntax | Delete FROM Table_name where condition; | Drop Table Table_name; | Truncate Table Table_name. |
Where Clause | Can be used with or Without Where clause | Cannot be used with where Clause | Cannot be used with the Where clause |
Rollback | Rollback is possible but before COMMIT is applied. | Rollback is not possible | Rollback is not possible |
Apply Commands on Table Difference | DELETE FROM Difference Where House='Pink'; | DROP Table Difference; | TRUNCATE Table Difference; |
OUTPUT OF DELETE COMMAND:
OUTPUT OF DROP COMMAND:
OUTPUT OF TRUNCATE COMMAND: