📖
Theory
Understand the concept step by step
COMMIT makes the changes of a transaction permanent according to the database transaction model.
ROLLBACK reverses changes that are still eligible to be rolled back within the current transaction.
Exact behavior can depend on the database system and transaction configuration.
💻
Example
See how the concept works in SQL
SQL
BEGIN;
UPDATE users
SET status = 'inactive'
WHERE id = 10;
ROLLBACK;📤
Output
Understand what the query produces
The uncommitted update is rolled back.
📝
Practice
Test your understanding
Run an update inside a transaction and test both COMMIT and ROLLBACK.
❓
MCQs
Check your SQL knowledge
What is the main concept covered in COMMIT and ROLLBACK?
A.COMMIT saves and ROLLBACK reverses eligible uncommitted changes
B.Both commands delete tables
C.Both commands create indexes
D.Both commands select rows
💼
Interview Questions
Prepare for SQL interviews
1
Interview Question
What does COMMIT do?
2
Interview Question
What does ROLLBACK do?
3
Interview Question
When would you use ROLLBACK?