Junior — Middle
Can you explain the principles of transactional integrity in databases, known as ACID?
sobes.tech AI
Answer from AI
ACID is a set of principles that ensure reliable and consistent transactions in databases:
- Atomicity: The transaction is completed entirely or not at all. If any operation fails, all changes are rolled back.
- Consistency: After the transaction, the database remains in a valid state, satisfying all rules and constraints.
- Isolation: Parallel transactions do not affect each other, as if they were executed sequentially.
- Durability: Once a transaction is committed, its changes are permanent, even in case of system failures.
Example: transferring money between bank accounts involves a transaction that debits one account and credits another. If one operation fails, both should be rolled back to prevent data inconsistency.