A transaction is a group of operations treated as one logical unit, e.g. transferring Tk 1,000 from account A to B (debit A, credit B). ACID properties keep the database correct even with failures and concurrent users:
- Atomicity — all or nothing. If the credit to B fails, the debit from A is rolled back. Achieved with undo logs and rollback.
- Consistency — a transaction takes the database from one valid state to another, respecting all constraints (keys, checks, A + B total unchanged).
- Isolation — concurrent transactions do not see each other’s partial work; the result equals some serial order. Achieved with locking (2PL) or MVCC and isolation levels (Read Committed, Repeatable Read, Serializable).
- Durability — once committed, changes survive crashes and power loss. Achieved with write-ahead logging (redo log), flushing to disk and backups.
— rhs