Skip to content

Latest commit

 

History

History
43 lines (28 loc) · 1.18 KB

begin.md

File metadata and controls

43 lines (28 loc) · 1.18 KB
title summary category
BEGIN | TiDB SQL Statement Reference
An overview of the usage of BEGIN for the TiDB database.
reference

BEGIN

This statement starts a new transaction inside of TiDB. It is similar to the statements START TRANSACTION and SET autocommit=0.

In the absense of a BEGIN statement, every statement will by default autocommit in its own transaction. This behavior ensures MySQL compatibility.

Synopsis

BeginTransactionStmt:

BeginTransactionStmt

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> COMMIT;
Query OK, 0 rows affected (0.01 sec)

MySQL compatibility

This statement is understood to be fully compatible with MySQL. Any compatibility differences should be reported via an issue on GitHub.

See also