In this article
  1. Before you start
  2. Why interviewers ask this
  3. Transaction control language from first principles
  4. Worked example
  5. Trade-offs and edge cases
  6. How to answer it in an interview
  7. Common mistakes
  8. Follow-up questions
  9. Sources

Before you start

Why interviewers ask this

A candidate who cannot explain transaction control cannot say what happens to a bank transfer when the second of two writes fails. Interviewers use the topic to separate people who have only run single statements from people who have grouped writes that must stay together. The question usually starts as a definition, "what is TCL?", and moves to the difference between rollback and rollback to savepoint.

A weak answer lists four keywords. A strong answer says what each keyword does to the open transaction and to other sessions, names atomicity, and names autocommit. A Staff-level answer adds that engines differ: the MySQL 8.4 manual lists data definition language (DDL) statements, such as create table, among those that commit implicitly, while PostgreSQL lets you roll them back. The statements that change rows are called data manipulation language (DML) statements, and TCL decides whether their effects stay. The question is a staple of any SQL interview preparation guide.

Transaction control language from first principles

Transaction control language
Transaction control language (TCL) is the group of SQL statements that begin a transaction, end it with a commit or a rollback, set savepoints inside it and set its characteristics with set transaction. These statements do not read or change rows themselves; they decide whether the row changes made by other statements are kept.
Transaction
A transaction is a sequence of SQL statements that the database treats as one unit of work. When it is committed, its actions become visible to other sessions together; when it is rolled back, they never become visible at all, as the PostgreSQL tutorial on transactions states.
Savepoint
A savepoint is a named mark inside an open transaction that lets you undo every command run after the mark while keeping the work done before it. The transaction stays open after such a partial undo. In PostgreSQL, savepoints can only be set inside a transaction block.
Atomicity
Atomicity is the property that a transaction's changes are applied entirely or not at all; it is the A in the ACID (atomicity, consistency, isolation, durability) set of transaction properties, and commit and rollback are how a database delivers it.

In plain words

Think of a clerk who writes a transfer on a scratch pad. Nothing on the pad is final. When the clerk stamps the page, every line becomes real together. If the clerk tears the page up, none of it ever happened. A sticky note halfway down marks a spot the clerk can tear back to, keeping the lines above it.

The stamp is commit. Tearing up the page is rollback. The sticky note is savepoint. The analogy breaks in one place: a real database serves many sessions at the same time, and it shows the stamped page to all of them in one step.

In one precise sentence, transaction control language lets one session decide, for a group of changes, whether they are kept as a whole, discarded as a whole, or cut back to a marked point.

Step 1: Autocommit makes every statement its own transaction

Autocommit is the mode in which each SQL statement runs in its own transaction and is committed when it succeeds. The PostgreSQL manual page for undefined says that without begin, each statement is executed in its own transaction, committed at the end if it worked and rolled back if it did not. A transaction therefore always exists; begin only makes it bigger. The cost shows in the worked example below: if the debit and the credit are two autocommitted statements and the second fails, the debit is already committed and the illustrative total drops from 1000.00 to 900.00.1

begin initiates a transaction block: all statements after it run in a single transaction until an explicit commit or rollback. It can also set transaction modes such as read only or read write. In PostgreSQL, start transaction has the same functionality as begin, according to the same manual page.

Input: a stream of statements. Output: a boundary around them. You now know that the boundary comes from begin, not from the first statement.

Step 2: Commit makes the changes permanent and visible together

A commit is the statement that ends the current transaction and keeps its changes. The Oracle Database 21 concepts guide says a commit ends the current transaction and makes permanent all changes performed in it. The PostgreSQL tutorial adds the visibility rule: committed actions become visible to other sessions as a unit.

Input: an open block holding changes. Output: no open block, and changes that every session can see. A debit and a credit that sit in one block therefore appear together after commit, never one without the other.

After commit the transaction is over. Undoing the work then needs a new transaction that reverses it, because the original cannot be rolled back any more.

Step 3: Rollback discards the whole transaction

A rollback is the statement that ends the current transaction and throws away every change made in it. According to the PostgreSQL tutorial, rolled-back actions never become visible at all, and Oracle's guide agrees: "A rollback of an uncommitted transaction undoes any changes" made by its statements.

Input: an open block. Output: the data in the state it had before begin. Rollback is the safe exit when the second write of a pair fails or when you spot a mistake before committing.

In autocommit mode you rarely issue it, because the database rolls back a failed single statement itself, as the manual page for begin notes. Inside a block, you or your code must send rollback.

Step 4: A savepoint marks a point you can roll back to without ending the transaction

A savepoint lets a transaction undo part of its work. undefined establishes a new savepoint within the current transaction, and rollback to savepoint rolls back all commands executed after it was established, according to the PostgreSQL manual page on rolling back to a savepoint. The transaction stays open, and the savepoint remains valid, so you can roll back to it again.

Rolling back to a savepoint destroys any savepoints created after it, not the one you named. release savepoint destroys a savepoint but keeps the work done after it. A transaction can hold several savepoints, and in PostgreSQL they can only be set inside a transaction block.

Input: an open block with a mark in it. Output: the same block, cut back to the mark. Savepoints are partial-rollback marks, not independent transactions: nothing inside them becomes visible before the outer commit.

The full statement set at a glance:

Seven statements make up TCL, and only commit and rollback end a transaction.
StatementWhat it doesExample
begin / start transactionOpens a transaction blockbegin;
commitEnds the transaction and keeps its changescommit;
rollbackEnds the transaction and discards its changesrollback;
savepointMarks a point inside the transactionsavepoint after_debit;
rollback to savepointUndoes work after the mark; the block stays openrollback to savepoint after_debit;
release savepointDestroys the mark and keeps the workrelease savepoint after_debit;
set transactionSets isolation level and read-only or read-write modeset transaction read only;

Oracle's concepts guide lists set transaction among its transaction control statements.

Autocommit wraps single statements and a block widens the boundaryBoxes and arrows in four steps: single statements each run in their own implicit transaction, begin widens the boundary into a block of changes, commit keeps all changes, rollback discards them, and a savepoint is a mark inside the changes.Statement 1own transactionStatement 2own transactionBeginwidens theblockYour changesinside the blockCommitkeeps changesRollbackdiscardschangesroll back toSavepointa mark insideDiagram: Interview Clozo, CC BY 4.0 ·interview.clozo.ai/blog/transaction-control-language.html

Autocommit wraps each statement; begin widens the boundary, commit or rollback ends it, and a savepoint is only a mark inside it.CC BY 4.0 — source: What is transaction control language (TCL) in SQL?
Step-by-step description
  1. Each statement is its own transaction; begin widens the boundary.
  2. Commit keeps every change in the block.
  3. Rollback discards every change in the block.
  4. A savepoint is a mark; rollback to it keeps the block open.
  • Autocommit makes each statement its own transaction, and begin opens a larger block.
  • Commit keeps all changes and rollback discards all changes.
  • A savepoint is a mark inside the block, and rollback to it undoes later work while the transaction stays open.

Knowing it is half the job. Saying it is the other half.

Interview Clozo is an AI interview copilot for real interview rounds: it hears the question and puts a strong answer on your screen, and you say it in your own words. See the features or how it works.

Start Free Trial →

Worked example

An illustrative transfer moves 100.00 between accounts. The balances are also illustrative: Alice 500.00, Bob 300.00 and Wally 200.00, a total of 1000.00.1 The PostgreSQL tutorial tells the same story: debit one account, credit another, then find the credit should have gone to a third. Here is that fix with a savepoint:

begin;
update accounts set balance = balance - 100.00 where name = 'Alice';
savepoint after_debit;
update accounts set balance = balance + 100.00 where name = 'Bob';
-- wrong account: undo only the credit
rollback to savepoint after_debit;
update accounts set balance = balance + 100.00 where name = 'Wally';
commit;

The accounts table is assumed. The check query is select sum(balance) from accounts, which is how a total like the one above is computed; this guide to conditional totals in SQL shows more forms of it.

Three runs of a small simulation of the documented rules give these results.1 Under autocommit, the debit commits alone; if the credit then fails, the total falls to 900.00 and 100.00 has vanished.1 In a block, a failed credit followed by rollback restores every balance to its starting value. With the savepoint fix, Alice ends at 400.00, Bob at 300.00 and Wally at 300.00, while other sessions still see 500.00, 300.00 and 200.00 until the commit.1

With illustrative balances, a transaction block keeps the total at 1000.00 whether the transfer is rolled back or corrected, while autocommit loses 100.00 when a failure falls between the two writes.
ScenarioAliceBobWallyTotal
Start500.00300.00200.001000.00
Autocommit, failure after the debit400.00300.00200.00900.00
Block, rollback500.00300.00200.001000.00
Block, savepoint fix, commit400.00300.00300.001000.00

The PostgreSQL savepoint page has a row example: insert 1, set a savepoint, insert 2, roll back to the savepoint, insert 3, commit. The documented result is rows 1 and 3 but not 2, and the simulation reproduces it.1

A failed transfer loses 100 under autocommit but not in a blockBar chart of the total of three illustrative balances: 1,000 at the start, 900 after autocommit with a failure between debit and credit, and 1,000 after a rollback or a savepoint fix.Total of three balances (units)04008001,200StartAutocommitRollbackSavepoint fixScenario1,0009001,0001,000Diagram: Interview Clozo, CC BY 4.0 ·interview.clozo.ai/blog/transaction-control-language.html
Autocommit leaves the debit committed alone, while a transaction block keeps the total at 1000.CC BY 4.0 — source: What is transaction control language (TCL) in SQL?
Text description of the diagram
  • The total of the three balances is 1,000 at the start.
  • Autocommit leaves the total at 900 after a failure between the debit and the credit.
  • A transaction block keeps the total at 1,000 whether the transfer is rolled back or corrected.

Trade-offs and edge cases

An explicit block trades convenience for correctness. Autocommit needs no extra statements, but it commits one statement at a time, so a failure after the first write leaves that write committed. A block commits many statements together, and you pay by writing commit and handling errors.

An explicit block commits many writes together, autocommit commits eachTable comparing autocommit with an explicit transaction block on writes per commit, what a failure after the first write leaves, when other sessions see changes, and partial undo.QuestionAutocommitExplicit blockWrites per commitOne statementManystatementsFailure after write oneFirst write stayscommittedRoll everythingbackOthers see changesAfter eachstatementTogether, atcommitPartial undoNot possibleUse a savepointDiagram: Interview Clozo, CC BY 4.0 ·interview.clozo.ai/blog/transaction-control-language.html
A block commits many statements together, while autocommit commits one statement at a time.CC BY 4.0 — source: What is transaction control language (TCL) in SQL?
Text description of the diagram
  • An explicit block commits many statements together; autocommit commits one statement at a time.
  • After a failure following the first write, autocommit leaves that write committed and a block lets you roll everything back.
  • Savepoints can only be set inside a transaction block.

Edge cases decide the Staff-level follow-ups:

  • Engines document different rules. Name yours. As of October 2026 the current PostgreSQL manual is version 18, where begin and start transaction are equivalent. The MySQL 8.4 manual lists data definition statements and begin / start transaction among the statements that cause an implicit commit.
  • DDL is transactional in PostgreSQL, not in Oracle or MySQL. In PostgreSQL a create table inside a block can be rolled back, as the PostgreSQL wiki on transactional DDL describes. The Oracle Database 21 concepts guide states that a DDL statement implicitly commits, and MySQL does the same, so a later rollback cannot undo it there.
  • Oracle and SQL Server use different syntax. Oracle has no begin or start transaction: a transaction starts with the first executable SQL statement, and the guide describes no server-side autocommit. SQL Server uses begin transaction and save transaction, documented on Microsoft Learn. For more dialect detail, see the Oracle SQL interview questions and the SQL Server interview questions.
  • Oracle names transactions. Its concepts guide shows set transaction with a name, which must be the first statement of the transaction.
  • Cursors ignore savepoint rollback. The PostgreSQL rollback-to manual page says cursor positions are not affected by a savepoint rollback.
  • Savepoints need a block. The PostgreSQL savepoint manual page allows savepoints only inside a transaction block.

How to answer it in an interview

Interviewer asks

What is transaction control language?

A strong answer

Transaction control language is the set of SQL statements that control a transaction: begin it, commit it, roll it back and set savepoints inside it. In PostgreSQL and MySQL each statement is its own transaction by default, which is autocommit mode. Begin groups several writes, so they become visible together at commit, or never if I roll back. A savepoint lets me undo part of the work while the transaction stays open. I keep blocks to the writes that belong together, and I name the engine, because MySQL and PostgreSQL differ on implicit commits.

The spoken structure: say the definition, say what autocommit does by default, say what commit and rollback do, then name the savepoint and one dialect difference.

Common mistakes

  • "No transaction exists until I type begin." (wrong) In PostgreSQL every statement already runs in its own transaction. (right) "Without begin each statement is its own transaction; begin groups several into one."
  • "rollback to savepoint ends the transaction." (wrong) The transaction stays open. (right) "It undoes the work after the mark; I still need commit or rollback."
  • "rollback to deletes the savepoint it names." (wrong) That savepoint remains valid and later ones are destroyed. (right) "I can roll back to the same savepoint again."
  • "Savepoints are nested transactions that commit on their own." (wrong) Nothing becomes visible before the outer commit. (right) "Savepoints are partial-rollback marks inside one transaction."

Follow-up questions

What does TCL stand for in SQL?

TCL stands for transaction control language, the group of statements that manage transactions: begin or start transaction, commit, rollback, savepoint, rollback to savepoint, release savepoint and set transaction. Oracle's concepts guide uses the heading "Overview of Transaction Control" for the same ideas. In PostgreSQL begin and start transaction have the same functionality, according to the current manual.

What is the difference between commit and rollback?

commit ends the transaction and keeps its changes, which then become visible to other sessions together. rollback ends it and discards every change.

What is the difference between rollback and rollback to savepoint?

rollback ends the whole transaction. rollback to savepoint undoes only the work after the mark and leaves the transaction open.

Does rollback to savepoint delete the savepoint?

No. The named savepoint stays valid, and only savepoints created after it are destroyed. release savepoint is the statement that removes a savepoint while keeping its work.

Is TCL the same as DML in SQL?

No. DML statements such as insert, update and delete change rows, and TCL statements decide whether those changes are kept. Both sit inside the wider SQL interview guide.

What is the difference between DDL, DML, DCL and TCL?

SQL statements fall into four groups. Data definition language (DDL) defines structure: create, alter and drop. Data manipulation language (DML) changes rows in the tables of a relational database: insert, update and delete. Data control language (DCL) manages permissions: grant and revoke. TCL controls transactions: commit, rollback, savepoint and set transaction.

Key takeaways
  • Transaction control language is the SQL statements that begin, commit, roll back and mark savepoints in a transaction.
  • Without begin, autocommit makes each statement its own transaction.
  • commit keeps all changes and shows them to other sessions together; rollback discards them all.
  • rollback to savepoint undoes part of the work, keeps the savepoint and leaves the transaction open.
  • Commit and rollback deliver atomicity, the A in ACID.
  • Engines differ on implicit commits and on DDL inside a block, so name the engine in your answer.

Sources

  1. PostgreSQL documentation: BEGIN (current manual, version 18) — PostgreSQL Global Development Group, 25 Sep 2025
  2. PostgreSQL documentation: SAVEPOINT (current manual) — PostgreSQL Global Development Group, 25 Sep 2025
  3. PostgreSQL tutorial: Transactions (current manual) — PostgreSQL Global Development Group, 25 Sep 2025
  4. PostgreSQL documentation: ROLLBACK TO SAVEPOINT (current manual) — PostgreSQL Global Development Group, 25 Sep 2025
  5. Transactional DDL in PostgreSQL: A Competitive Analysis — PostgreSQL wiki, 26 Oct 2026
  6. Oracle Database 21 Concepts: Transactions — Oracle, 26 Oct 2026
  7. MySQL 8.4 Reference Manual: Statements That Cause an Implicit Commit — Oracle MySQL, 30 Apr 2024
  8. SAVE TRANSACTION (Transact-SQL) — Microsoft Learn, 26 Oct 2026