👋 Introduction

Have you ever wondered what happens when two people try to withdraw money from the same bank account at the same time? Databases handle such cases using transactions, locks, and recovery logs to make sure data always stays consistent.

In this blog, we’ll explore:

  • How transactions maintain atomicity
  • What a deadlock is and how it’s detected
  • How log-based recovery ensures data safety after a crash
CREATE TABLE Accounts (
acc_no INT PRIMARY KEY,
name VARCHAR(50),
balance INT
);

INSERT INTO Accounts VALUES
(1, 'Alice', 1000),
(2, 'Bob', 1500),
(3, 'Charlie', 2000);


⚙️ 2️⃣ Transaction – Atomicity & Rollback

🧠 Concept: A transaction ensures that all steps succeed or none at all. If any step fails, the database will rollback to th…

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help