ACID Properties Of Transaction in DBMS

Atomicity

It states that a transaction must be treated as a single atomic unit i.e. Either transaction executed successfully or completely failed. It should not stuck in between or execute partially. The states of the transaction should be defined before execution or after the execution or failure or abortion of the transaction.

For example:

Suppose A has transferred $100 to B. In this case if money transferred successfully, amount should credit to Account B. But if failure occurs then amount should not credited to Account B, But Amount is already debited from A. So this situation is creating the data issue which show atomicity is not followed in this case.

So If Amount debited From Account A, It should credited to Account B.

Consistency

Transactions preserve the consistency of the database. It means we should not loose the integrity of data in any transaction. Suppose if some changes made on the database it should preserved the value before and after transaction.

For Example:

To understand consistency better, Lets take an example of ticket booking System. Suppose if one person is trying to book the 2 movie ticket, But due to payment failure ticket not booked. But here two seat is reserved for that person because before payment we have to choose the seat. Now after the payment failure system should release the two reserved seat and increase the count of available seat.

If this updating not happened correctly, we can say data is not consistent.

Isolation

Isolation means data on one transaction should not impact the data of other transaction. As we know that at the same time there are multiple transactions are executed. If the two transactions are working on the same data then first one transaction will finish the operation then second will start. And if the two transaction are working on different database then they should not impact others database. This property is basically Isolation means one transaction should not impact others and each transaction should be isolated.

Durability

Transactions make sure that the modifications made on data should be persisting in database, even in the event of device failure.  Suppose if any modification done on the database, records should save permanently. And in case of system failures, database should survive. Otherwise there is huge loss.

For example you can assume if banking database failed due to some issue. All records of the users will be lost which leads to trust issue and amount losses of the customer. Our durable system should protect from such scenario.