# Transaction Control Example

__*Transaction Control*__
__*BEGIN*__

+ Explicit transaction control take precedence over `autocommit`

```
tidb> ~!@BEGIN@!~
tidb> INSERT INTO test.t1 VALUES(1);
tidb> INSERT INTO test.t1 VALUES(2);
tidb> SELECT * FROM test.t1;
+------+
| id   |
+------+
|    1 |
|    2 |
+------+

tidb> SELECT @@autocommit;
+--------------+
| @@autocommit |
+--------------+
|            1 |
+--------------+

tidb> ~!@ROLLBACK@!~;
tidb> SELECT * FROM test.t1;
Empty set (0.00 sec)
```
------------------------------------------------------------

The BEGIN statement takes precedence over the @ @autocommit setting.

