Cancel the transaction by issuing a ROLLBACK statement. : RollBack « Transaction « SQL / MySQL






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>

   
    
    
    
    
    
  








Related examples in the same category

1.User transaction in table
2.The ROLLBACK Statement
3.Rollback work