An e-commerce application wraps two statements in one transaction: insert the order row, then decrement the product's inventory. The inventory update fails on a constraint violation, and the business requires that the order row must then not remain either. Which ACID property guarantees this behavior?
Select an answer to reveal the explanation.
Short Explanation
Atomicity is the all-or-nothing deal: either both steps happen or neither does. It's like a bank transfer where the money can't leave one account without landing in the other. If the second step fails, you get the first one rolled back with it.
Full Explanation
Atomicity means a transaction is an indivisible unit of work: either every statement in it takes effect or none does. When the inventory update fails, the engine, or the application through an explicit ROLLBACK, undoes the already executed order insert using the transaction log, leaving the database as if the transaction never started. That is exactly the requirement that no order row remains without the matching inventory change. Consistency means a transaction moves the database from one valid state to another, honoring constraints, keys and rules; the failed constraint shows consistency being enforced, but removing the partial order is atomicity's job. Isolation governs how concurrent transactions see each other's uncommitted changes, which is unrelated to a single transaction undoing its own work after an error. Durability ensures that once a transaction commits, its changes survive crashes; here the transaction never commits, so durability is not the property in play. Exam caveat: some engines abort only the failing statement rather than the whole transaction, so the application must check for errors and roll back explicitly to get all-or-nothing behavior. Operational check: in a test environment, force the inventory update to fail and confirm that no order row is visible after the transaction ends.