Why do transactions guarantee atomicity?
Transactions guarantee atomicity because the database executes them as a single unit - a set of actions that can't be split into parts.
If even one step of a transaction fails, the system rolls back everything, using logging mechanisms (a transaction log). That means no intermediate changes ever make it into the database.
For example, when transferring money from one account to another, the debit and credit operations either both run, or both get undone. This achieves the "all or nothing" principle, and the database stays consistent regardless of errors, failures, or outages.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.