ACID (Atomicity, Consistency, Isolation, Durability) is a set of properties that guarantee database transactions are processed reliably.
Transaction: A transaction is one or more actions that are defined as single unit of work.
Atomicity: All or nothing execution.
In a sequence of steps either all actions occur or none. Atomicity means that users do not have to worry about the effect of incomplete transactions. If an action fails half-way through a transaction, then all previous actions in the transaction must be rolled back as if they never happened.
Example: Moving money from savings to checking accounts , withdrawing money from bank accounts
Consistency : Execution of transaction results in consistent database.
The database is transformed from one valid state to another valid state.
Example: If someone moves 5,000$ from their bank account that information is logged. If it can't be logged then the money is not transferred.
Isolation : Many transactions may execute concurrently but each is unaware of the others.
The results of a transaction are invisible to other transactions until the transaction is complete.
Example: If someone querying balance amount at 12.00 AM , now at 12.01 AM user Bunty deposits 250$. The query results even if it finishshes at 12.04AM will not show the changes made by Bunty.
Durability : Persistence.
Once transaction is committed (completed), the results of a transaction are permanent and survive future system and media failures.
Example: Once your seat is reserved on an airplane, even if the system crashes the moment it finishes writing that information in the database your seat will still be reserved.