Sobes.tech
Junior — Middle

Kas saaksite selgitada, mida mõistetakse andmebaasides tehinguna?

sobes.tech AI

Vastus AI-lt

A transaction in databases is a sequence of operations that is executed as a single unit. The main idea is that either all operations of the transaction succeed or none of them are applied (atomicity).

Transactions guarantee four key properties (ACID):

  • Atomicity: all operations within a transaction are either fully completed or not at all.
  • Consistency: after the transaction completes, the database remains in a correct state.
  • Isolation: parallel transactions do not affect each other.
  • Durability: after a transaction is committed, changes remain even in case of failures.

Example: when transferring money between accounts in a bank, the transaction ensures that the deduction from one account and the credit to another happen together, to prevent loss or creation of money.