DELETE
- DELETE removes some specific rows (with WHERE clause) or all rows
(without WHERE clause)
- The operation can be rolled back.
- DELETE is a DML command.
- This operation cause all DELETE triggers on table to fire.
- Conditions like WHERE clause can be used.
Note: when we issue a DELETE command then
all data get copied into ROLLBACK Tablespace first. Then delete operation get
performed. That is why when you type ROLLBACK after deleting table, you can get
back the data (The system get it for you from the Rollback Tablespace)
TRUNCATE
- TRUNCATE removes all rows from a table.
- The operation cannot be rolled back.
- TRUNCATE is a DDL command.
- No triggers will be fired.
- Conditions like WHERE clause cannot be used with it.
- TRUNCATE is faster than DELETE.
Note: when you issue a TRUNCATE
command, it removes data directly without copying it into the Rollback
Tablespace. So it is faster than DELETE. Also because of the same reason the
data deleted using TRUNCATE command cannot be rolled back.
DROP
- DROP removes a table from the database.
- The operation cannot be rolled back.
- DROP is a DDL command.
- No trigger is fired.
- Conditions like WHERE clause cannot be used with it.
Note: DROP command deletes all content as
well as structure but TRUNCATE delete all contents only and not the structure.
DELETE
TRUNCATE
Note: when you issue a TRUNCATE
command, it removes data directly without copying it into the Rollback
Tablespace. So it is faster than DELETE. Also because of the same reason the
data deleted using TRUNCATE command cannot be rolled back.
DROP
Note: DROP command deletes all content as
well as structure but TRUNCATE delete all contents only and not the structure.
Comments
Post a Comment