Database Fundamentals — Question 79
You execute a statement inside a transaction to delete 100 rows from a table. The transaction fails after only 40 rows are deleted.
What is the result in the database?
Answer options
- A. The table will be corrupted.
- B. Forty (40) rows will be deleted from the table.
- C. The transaction will restart.
- D. No rows will be deleted from the table.
Correct answer: D
Explanation
In a transaction, if it fails at any point, the database reverts to its original state before the transaction began, which means no changes are made. Therefore, no rows will be deleted from the table. Options A, B, and C are incorrect because they suggest that some changes would have been made or that the table would be in a corrupted state, which is not true in the context of a failed transaction.