🔄 TCL (Transaction Control Language) in SQL

Last Updated: January 2026


TCL (Transaction Control Language) is a category of SQL commands used to manage transactions in a database.

👉 TCL controls when data changes are permanently saved or undone.

A transaction is a sequence of one or more SQL statements that are treated as one logical unit of work.

Example:

  • Insert data
  • Update data
  • Delete data

All of these together can be committed or rolled back.

Hinglish Tip 🗣: Multiple queries ko ek group ki tarah handle karna aur decide karna ki save karna hai ya cancel — yahi transaction hota hai.

Every transaction follow ACID (Atomicity, Consistency, Isolation, Durability) properties.

  • Atomicity: All changes in a transaction are either committed or rolled back.
  • Consistency: Data remains consistent after a transaction.
  • Isolation: Transactions are isolated from each other.
  • Durability: Data is persisted even if the database fails.

🧩 TCL Commands

We will cover each command separately in upcoming tutorials. For now, this is a high-level overview.

COMMIT

  • Saves all changes made in the current transaction
  • Changes become permanent
COMMIT;

ROLLBACK

  • Undoes changes made in the current transaction
  • Returns database to last committed state
ROLLBACK;

SAVEPOINT

  • Creates a checkpoint inside a transaction
  • Allows partial rollback
SAVEPOINT sp1;