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?
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?
When a transaction fails, it means that none of the changes made during the transaction are successfully committed to the database. This follows the ACID properties of transactions, specifically the Atomicity property, which ensures that all operations within a transaction are completed successfully; otherwise, none are applied. Therefore, if the transaction fails after deleting 40 rows, the entire transaction will be rolled back, and no rows will actually be deleted from the table.
If transaction has failed statements inside - then all changes are rolled back.
this explains ACID property of a transaction