
DELETE
• Use to remove rows from a table.
• If WHERE clause defined, some rows are remove. If no WHERE clause defined, all rows will be remove.
• Need to COMMIT after DELETE command is executed.
• Can ROLLBACK to undo the transaction.
Example
1. Display rows from table cars.
SQL> select * from cars; BRAND Toyota Honda Proton
2. Delete Toyota from the table cars.
SQL> delete from cars where BRAND=Toyota;
TRUNCATE
• Use to remove all rows.
• No COMMIT is needed and no undo. The command cannot be ROLLBACK.
Example
1. Truncate table.
SQL> TRUNCATE table cars;
SQL> select * from cars; BRANDS
DROP
• To remove a table from the database.
• Everything inside the table will be remove.
• Operation cannot be rollback
Example
1. Drop/Delete a table.
SQl> DROP table cars;
