The ROLLBACK Statement : RollBack « Transaction « SQL / MySQL






The ROLLBACK Statement

      
mysql>
mysql> CREATE TABLE Books
    -> (
    ->     BookID SMALLINT NOT NULL PRIMARY KEY,
    ->     BookTitle VARCHAR(60) NOT NULL,
    ->     Copyright YEAR NOT NULL
    -> )
    -> ENGINE=INNODB;
Query OK, 0 rows affected (0.00 sec)

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

mysql> INSERT INTO Books VALUES (101, 'Notebook', 1934);
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO Books VALUES (102, 'C++', 1919);
Query OK, 1 row affected (0.00 sec)

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

mysql>
mysql>
mysql> drop table Books;
Query OK, 0 rows affected (0.00 sec)

   
    
    
    
    
    
  








Related examples in the same category

1.User transaction in table
2.Cancel the transaction by issuing a ROLLBACK statement.
3.Rollback work