Cards (36)

  • What is a transaction in the context of databases?
    Logical unit of work
  • Each transaction in a database must adhere to the ACID properties to maintain data integrity.integrity
  • What does Atomicity ensure in a database transaction?
    All operations succeed or fail together
  • Consistency in ACID properties ensures that a transaction moves the database from one consistent state to another.
  • Isolation in ACID properties prevents one transaction from seeing changes made by another until it is committed
  • What does Durability guarantee in a database transaction?
    Changes are permanent after commitment
  • Steps involved in transferring money from account A to account B in a database transaction
    1️⃣ Deduct the amount from account A
    2️⃣ Add the amount to account B
    3️⃣ Commit the changes to the database
  • If any step in a transaction fails, the entire transaction is rolled back to maintain consistency.
  • Atomicity in ACID properties ensures all operations in a transaction complete successfully or none are executed
  • What does Isolation prevent in concurrent database transactions?
    Interference between transactions
  • Transferring money between accounts is an example of a transaction that ensures funds are deducted from one account and added to another.
  • What happens to a bank transfer transaction if the credit to the destination account fails?
    The entire transaction is rolled back
  • Isolation in ACID properties prevents concurrent transactions from interfering with each other's changes
  • What happens if the credit to account B fails during a money transfer transaction?
    The debit from A is undone
  • Atomicity ensures that all operations in a transaction are treated as a single, indivisible unit.
  • Atomicity in database transactions ensures that all operations within a transaction are treated as a single, indivisible unit
  • What is the effect of a rollback in a database transaction on the data integrity?
    Restores the database to its original state
  • If a transaction fails and is rolled back, the database returns to its consistent state before the transaction began.
  • In a bank transfer transaction, if the debit from account A is successful but the credit to account B fails, the transaction is rolled back
  • Match the ACID property with its definition:
    Atomicity ↔️ All operations succeed or fail together
    Consistency ↔️ Database moves from one consistent state to another
    Isolation ↔️ Transactions are independent
    Durability ↔️ Changes are permanent after commitment
  • Two users updating the same stock level without affecting each other is an example of Isolation.
  • Atomicity in ACID properties ensures all operations in a transaction complete successfully, or none at all
  • What is the primary purpose of Consistency in ACID properties?
    Preserve the database integrity
  • What does atomicity ensure in database transactions?
    All or nothing
  • In atomicity, every operation in a transaction must either succeed or fail together
  • If a credit to account B fails during a money transfer, the debit from account A is undone.
  • Match the aspect of atomicity with its definition:
    All or Nothing ↔️ Every operation succeeds or fails together
    Rollback ↔️ Reverts to the original state
    Consistency ↔️ Ensures data integrity
  • What does consistency ensure in database transactions?
    Data integrity
  • The total balance of all accounts remains the same before and after a consistent bank transfer.
  • Consistency ensures that all database rules and constraints are satisfied
  • What does isolation prevent in concurrent database transactions?
    Data corruption
  • The "Read Uncommitted" isolation level prevents dirty reads.
    False
  • Match the isolation level with its description:
    Read Uncommitted ↔️ Reads uncommitted data
    Read Committed ↔️ Reads only committed data
    Repeatable Read ↔️ Protects against non-repeatable reads
    Serializable ↔️ Ensures serial execution
  • What does durability guarantee in database transactions?
    Permanent changes
  • Write-Ahead Logging (WAL) is used to ensure durability by recording changes in a log
  • Regular backups are essential for database recovery in case of system failures.