Doc Menu
Important

You are viewing the documentation of an older version of the TiDB database (TiDB v3.1).

It is recommended that you use the latest stable version of the TiDB database.

ROLLBACK

This statement reverts all changes in the current transaction inside of TIDB. It is the opposite of a COMMIT statement.

Synopsis

Statement:

Statement

Examples

mysql> CREATE TABLE t1 (a int NOT NULL PRIMARY KEY);
Query OK, 0 rows affected (0.12 sec)

mysql> BEGIN;
Query OK, 0 rows affected (0.00 sec)

mysql> INSERT INTO t1 VALUES (1);
Query OK, 1 row affected (0.00 sec)

mysql> ROLLBACK;
Query OK, 0 rows affected (0.01 sec)

mysql> SELECT * FROM t1;
Empty set (0.01 sec)

MySQL compatibility

TiDB does not support the syntax ROLLBACK TO SAVEPOINT. Any compatibility differences should be reported via an issue on GitHub.

See also