Mega Code Archive

 
Categories / MySQL / Transaction
 

Cancel the transaction by issuing a ROLLBACK statement

mysql> mysql> CREATE TABLE t (i INT) TYPE = InnoDB; Query OK, 0 rows affected, 1 warning (0.01 sec) mysql> BEGIN; Query OK, 0 rows affected (0.00 sec) mysql> INSERT INTO t (i) VALUES(1); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO t (i) VALUES(2); Query OK, 1 row affected (0.00 sec) mysql> ROLLBACK; Query OK, 0 rows affected (0.00 sec) mysql> SELECT * FROM t; Empty set (0.00 sec) mysql> mysql> drop table t; Query OK, 0 rows affected (0.00 sec) mysql>