ACID Properties in databases:
Main Idea | Explanation | Examples | Key Terms |
---|---|---|---|
Atomicity | Ensures that a transaction is all-or-nothing. If one part fails, the entire transaction is rolled back. | Transferring ₹500 from Account A to Account B: If the debit succeeds but the credit fails, both are undone. | Transaction, Rollback |
Consistency | Ensures that a transaction brings the database from one valid state to another. | Transferring money should always keep the total balance unchanged, maintaining data integrity. | Valid State, Constraints |
Isolation | Ensures that transactions are executed independently of one another. | Two users withdrawing money from the same account simultaneously should not interfere with each other. | Concurrency, Locking |
Durability | Ensures that once a transaction is committed, it is permanently recorded, even in case of failures. | A successfully updated order record remains intact even if the system crashes right after. | Commit, Persistence |
Key Notes:
- Atomicity prevents partial updates.
- Consistency enforces database rules.
- Isolation avoids conflicts between concurrent transactions.
- Durability protects data after a successful transaction.
MCQ
What does the ‘A’ in ACID stand for?
A) Accessibility
B) Atomicity
C) Accuracy
D) Automation
Answer: B
Which ACID property ensures that a transaction moves the database from one valid state to another?
A) Durability
B) Isolation
C) Consistency
D) Atomicity
Answer: C
Atomicity in ACID properties means:
A) Transactions can partially succeed.
B) Either the entire transaction completes or none of it does.
C) Transactions are visible to others while being processed.
D) Data is retained only temporarily.
Answer: B
Which of the following ensures that committed data is not lost even during system failure?
A) Isolation
B) Atomicity
C) Consistency
D) Durability
Answer: D
If two users try to withdraw money from the same account simultaneously, which ACID property prevents data conflicts?
A) Atomicity
B) Isolation
C) Consistency
D) Durability
Answer: B
In a bank transfer, ₹500 is debited from one account but not credited to the other due to a system crash. Which property was violated?
A) Isolation
B) Durability
C) Atomicity
D) Consistency
Answer: C
Which property ensures that database constraints like primary keys or foreign keys are always followed?
A) Atomicity
B) Consistency
C) Durability
D) Isolation
Answer: B
In ACID properties, ‘Isolation’ is achieved using which technique?
A) Logging
B) Locking mechanisms
C) Rollback
D) Indexing
Answer: B
What is a transaction called that ensures ACID compliance?
A) Consistent Transaction
B) Reliable Transaction
C) Valid Transaction
D) ACID Transaction
Answer: D
Durability ensures that:
A) Uncommitted transactions are visible to all users.
B) Completed transactions are permanently stored.
C) Transactions are independent of each other.
D) Data integrity is not enforced.
Answer: B