Correct option is C
The
DELETE command in SQL can be rolled back because it is a part of a transaction that affects the data in a table. Before committing the transaction, a rollback can restore the data to its previous state. On the other hand, commands like COMMIT and DDL (Data Definition Language) commands, such as CREATE and ALTER, cannot be rolled back once executed.
Important Key Points:
1.
DELETE Command:
· Allows rollback as it doesn’t modify the table structure but only deletes data within a transaction.
· Often used with WHERE clauses for conditional deletions.
2.
COMMIT Command:
· Finalizes all changes in a transaction, making them permanent and non-reversible.
3.
DDL Commands:
· Commands like CREATE and ALTER modify the database structure and are auto-committed, so they cannot be rolled back.
4.
SELECT Command:
· Doesn’t alter data or structure, so rollback doesn’t apply.
Knowledge Booster:
·
Difference between DELETE and TRUNCATE:
· DELETE can be rolled back; TRUNCATE cannot.
· TRUNCATE is faster and resets identity values.
·
ROLLBACK: Used to undo transactions that are not yet committed.
·
SAVEPOINT: Helps roll back a portion of a transaction by marking points within it.