An overview of ACID properties
In this section, we will discuss each of the ACID properties and understand their importance in avoiding data loss and corruption. First, we will take a look at atomicity.
Atomicity
Atomicity refers to the integrity of a given transaction, which means if a transaction comprises multiple statements, atomicity ensures that either all of them succeed or none of them succeed. Atomicity is important to make sure that there is no data inconsistency because of a transaction getting partially executed.
Let's try to understand this with an example:
BEGIN TRANSACTION Read Foo's Account Debit $100 from foo's Account Read Bar's Account Credit $100 to bar's Account COMMIT
Here, you have a transaction in which you are debiting the money from Foo's Account
and crediting it to bar's Account
. Here, it's important that these two activities happen as a single unit of work. Otherwise, it can result in data...