Another way to group statements is to turn off auto-commit mode explicitly.
mysql>
mysql> CREATE TABLE t (i INT) TYPE = InnoDB;
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> SET AUTOCOMMIT = 0;
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> COMMIT;
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT * FROM t;
+------+
| i |
+------+
| 1 |
| 2 |
+------+
2 rows in set (0.00 sec)
mysql>
mysql> drop table t;
Query OK, 0 rows affected (0.00 sec)
mysql>
Related examples in the same category