Database Basics

Among the ACID properties a transaction should have, which is the property that a transfer debiting account A and crediting account B is either carried out completely or not at all, even if a failure occurs partway through?

  1. AConsistency
  2. BDurability
  3. CAtomicity
Show answer and explanation

Answer: C. Atomicity

The ACID properties are named after the initials of four properties a transaction should satisfy. Atomicity means the operations in a transaction are either all executed or none are; if a failure occurs, the updates made so far are cancelled. Consistency means the data keeps satisfying integrity constraints (balances never negative, foreign keys always referring to existing rows, and so on) before and after the transaction. Isolation means that transactions running concurrently do not interfere with each other and produce the same result as if they had been executed one at a time. Durability means that the results of a committed transaction are not lost even if a failure occurs afterwards. The all-or-nothing property in the question is atomicity.

  • A. Consistency is the property that data keeps satisfying integrity constraints before and after a transaction.
  • B. Durability is the property that committed results survive later failures.
  • C. Correct. Atomicity is the property that everything is executed or nothing is.
Practice this topic Back to topic

Related calculators

Books on Database Basics Ad

As an Amazon Associate I earn from qualifying purchases.

More Database Basics questions

  1. The stock count of a product in a stock table is 10. Transaction T1 reads the stock count and writes back the value minus 3, and T2 reads the stock count and writes back the value minus 5. If they run without locks in the order T1 reads, T2 reads, T1 writes, T2 writes, what is the final stock count?
  2. Among the problems that occur when transactions run concurrently, which correctly describes a dirty read?
  3. Transaction T1 ran SELECT COUNT(*) FROM orders WHERE amount >= 1000 and got 8. Immediately afterwards, T2 inserted an order row with an amount of 2000 and committed. When T1 ran the same SELECT statement again, it got 9. What is this phenomenon?
  4. Among the isolation levels defined by the SQL standard, which correctly lists the phenomena that can occur under READ COMMITTED?
  5. Transaction T1 holds a shared lock on a row and is reading it. T2 requests a shared lock and T3 requests an exclusive lock on the same row. Which is correct for the period until T1 releases its lock?