Junior — Middle
What does the term 'transaction consistency' mean in the context of databases?
sobes.tech AI
Answer from AI
Transaction consistency in databases means that after a transaction is executed, the database transitions from one correct state to another without violating the specified rules and constraints (for example, data integrity).
This is part of the ACID principles, where:
- The transaction must preserve all constraints, triggers, and integrity rules.
- If the transaction completes successfully, all changes should be consistent and correct.
- If an error occurs, the database should roll back to the state before the transaction started to prevent inconsistent data.
Example: if in a banking system money is transferred from one account to another — consistency guarantees that the debit and credit amounts match, and the balance is not violated.