ECET 2026 CSE

Day 73 (Evening) – DBMS: COMMIT, ROLLBACK & SAVEPOINT in SQL (ECET 2026 CSE)

Concept Notes (Deep Explanation + Examples)

1️⃣ Introduction: Why Transaction Control Matters in DBMS

In real-world databases (banks, exam portals, e-commerce sites), data safety is critical.
Imagine:

  • Student paying ECET exam fee πŸ’³
  • Bank deducts money ❌ but registration not updated ❌

To avoid such issues, DBMS uses transactions with control commands:

  • COMMIT
  • ROLLBACK
  • SAVEPOINT

πŸ“Œ These are called Transaction Control Language (TCL) commands in SQL.


2️⃣ What is a Transaction? (From Basics)

A transaction is a group of SQL operations executed as one logical unit.

Example:

UPDATE accounts SET balance = balance - 1000 WHERE acc_no = 101;
UPDATE accounts SET balance = balance + 1000 WHERE acc_no = 202;

πŸ‘‰ Both statements together form one transaction.

If one fails β†’ whole transaction should fail.

This follows ACID properties:

  • Atomicity
  • Consistency
  • Isolation
  • Durability

3️⃣ COMMIT Command (Permanent Save)

πŸ”Ή Meaning:

COMMIT permanently saves all changes made during the transaction.

Once committed:

  • Changes are written to disk
  • Cannot be undone

πŸ”Ή Syntax:

COMMIT;

πŸ”Ή Real-world Example:

πŸ’‘ Online exam submission

  • Student submits answers
  • Data stored permanently
  • Even if system crashes β†’ data remains

πŸ”Ή SQL Example:

UPDATE student SET marks = 85 WHERE roll_no = 10;
COMMIT;

πŸ“Œ After COMMIT, ROLLBACK will NOT work.


4️⃣ ROLLBACK Command (Undo Changes)

πŸ”Ή Meaning:

ROLLBACK undoes all changes made after the last COMMIT.

Used when:

  • Error occurs
  • User cancels operation
  • System failure

πŸ”Ή Syntax:

ROLLBACK;

πŸ”Ή Real-world Example:

πŸ’‘ ATM Transaction

  • Money deducted
  • Cash not received
  • Transaction rolled back

πŸ”Ή SQL Example:

SAVEPOINT sp1;
ROLLBACK TO sp1;

πŸ‘‰ Deleted row comes back!

πŸ“Œ Works only before COMMIT.


5️⃣ SAVEPOINT Command (Partial Rollback)

πŸ”Ή Meaning:

SAVEPOINT creates a checkpoint inside a transaction.

You can rollback up to a savepoint, not the entire transaction.

πŸ”Ή Syntax:

SAVEPOINT sp1;
ROLLBACK TO sp1;

πŸ”Ή Real-world Example:

πŸ’‘ Editing student record

  • Update name βœ”
  • Update marks ❌ wrong
  • Rollback only marks update

πŸ”Ή SQL Example:

UPDATE student SET name = 'Ravi' WHERE roll_no = 15;
SAVEPOINT s1;

UPDATE student SET marks = 120 WHERE roll_no = 15;
ROLLBACK TO s1;

COMMIT;

βœ” Name updated
❌ Marks not updated


6️⃣ Diagram Explained in Words (Transaction Flow)

Think of a whiteboard:

  • Write changes with chalk ✍️
  • Until COMMIT β†’ changes are temporary
  • COMMIT β†’ take permanent photo πŸ“Έ
  • ROLLBACK β†’ erase board 🧽
  • SAVEPOINT β†’ mark a checkpoint line 🟦

7️⃣ ECET Exam Important Points ⭐

βœ” COMMIT makes changes permanent
βœ” ROLLBACK undoes changes before COMMIT
βœ” SAVEPOINT allows partial rollback
βœ” TCL commands work with DML (INSERT, UPDATE, DELETE)
βœ” DDL commands (CREATE, DROP) do implicit COMMIT


βš™οΈ Formulas (Plain LaTeX – No Boxes)

(DBMS topic – No mathematical formulas applicable)


πŸ”Ÿ 10 MCQs (ECET + GATE Hybrid)

Q1. Which SQL command permanently saves a transaction?
A. ROLLBACK
B. SAVEPOINT
C. COMMIT
D. DELETE

Q2. ROLLBACK command can undo changes made after:
A. SAVEPOINT
B. COMMIT
C. DROP
D. SELECT

Q3. SAVEPOINT is used to:
A. End transaction
B. Delete table
C. Perform partial rollback
D. Commit changes

Q4. Which command creates a checkpoint in a transaction?
A. COMMIT
B. DELETE
C. SAVEPOINT
D. ROLLBACK

Q5. TCL commands work with which SQL commands?
A. DDL
B. DML
C. DCL
D. SELECT

Q6. Which of the following causes implicit COMMIT?
A. INSERT
B. UPDATE
C. CREATE
D. DELETE

Q7. After COMMIT, which command cannot undo changes?
A. SAVEPOINT
B. DELETE
C. ROLLBACK
D. SELECT

Q8. SAVEPOINT is valid until:
A. Server restart
B. ROLLBACK
C. COMMIT
D. SELECT

Q9. Which command undoes changes up to SAVEPOINT?
A. ROLLBACK
B. ROLLBACK TO SAVEPOINT
C. COMMIT
D. DELETE

Q10. TCL stands for:
A. Table Control Language
B. Transaction Control Language
C. Transfer Control Language
D. Technical Control Language


βœ… Answer Key (WordPress Table β€” NO HTML)

Q No | Answer
1 | C
2 | A
3 | C
4 | C
5 | B
6 | C
7 | C
8 | C
9 | B
10 | B


🧠 MCQ Explanations

Q1: COMMIT saves data permanently βœ”
Others undo or manipulate data ❌

Q2: ROLLBACK can revert till last SAVEPOINT βœ”
Not after COMMIT ❌

Q3: SAVEPOINT allows partial rollback βœ”
Not for commit or delete ❌

Q4: SAVEPOINT creates transaction checkpoints βœ”

Q5: TCL works only with DML commands βœ”

Q6: DDL commands auto-commit βœ”

Q7: After COMMIT, ROLLBACK fails βœ”

Q8: SAVEPOINT removed after COMMIT βœ”

Q9: ROLLBACK TO SAVEPOINT is correct βœ”

Q10: Full form is Transaction Control Language βœ”


🎯 Motivation (ECET 2026 Specific)

This topic appears every year in ECET from DBMS basics.
Mastering COMMIT–ROLLBACK–SAVEPOINT gives you:

  • Easy 1–2 guaranteed marks
  • Strong foundation for Transactions & Concurrency
  • Confidence in SQL questions

πŸ‘‰ Consistent revision = Rank boost πŸš€


πŸ“² CTA (Fixed)

Join our ECET 2026 CSE WhatsApp Group for daily quizzes & study notes:
https://chat.whatsapp.com/GniYuv3CYVDKjPWEN086X9

Leave a comment

Your email address will not be published. Required fields are marked *