Junior — Middle
Can you explain what a transaction is in the context of databases or data processing systems?
sobes.tech AI
Answer from AI
A transaction is a sequence of operations with a database or data processing system that is executed as a single unit. It has four key properties (ACID):
- Atomicity: all operations within the transaction are either completed entirely or not at all.
- Consistency: after the transaction completes, the data remains in a correct state.
- Isolation: concurrent transactions do not affect each other.
- Durability: after a transaction is committed, the changes are saved even in case of failures.
Example: when transferring money between accounts, the debit from one account and the credit to another must happen together; otherwise, the data will be inconsistent.