Collections:
Transaction Committed when DDL Statement Executed in MySQL
What Happens to the Current Transaction If a DDL Statement Is Executed in MySQL?
✍: FYIcenter.com
If a DDL statement is executed, the current transaction will be committed and ended. All the database changes made in the current transaction will become permanent. This is called an implicit commit by a DDL statement.
The following tutorial exercise shows you that the CREATE TABLE statement forced the current transaction to be committed and ended. The subsequent ROLLBACK command had no effects on the closed transaction:
>\mysql\bin\mysql -u dev -piyf fyi
mysql> START TRANSACTION;
Query OK, 0 rows affected (0.01 sec)
mysql> INSERT INTO fyi_links (url, id)
VALUES ('oracle.com', 112);
Query OK, 1 row affected (0.00 sec)
mysql> INSERT INTO fyi_links (url, id)
VALUES ('mysql.com', 113);
Query OK, 1 row affected (0.00 sec)
mysql> CREATE TABLE fyi_temp AS (SELECT * FROM fyi_links);
Query OK, 4 rows affected (0.22 sec)
Records: 4 Duplicates: 0 Warnings: 0
mysql> ROLLBACK;
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> SELECT * FROM fyi_links;
+-----+---------------+-------+--------+--------------------
| id | url | notes | counts | created
+-----+---------------+-------+--------+--------------------
| 101 | fyicenter.com | Good | 999 | 2006-07-01 20:34:10
| 110 | centerfyi.com | Wrong | 0 | 2006-07-01 20:34:12
| 112 | oracle.com | NULL | NULL | 2006-07-01 20:41:12
| 113 | mysql.com | NULL | NULL | 2006-07-01 20:41:21
+-----+---------------+-------+--------+--------------------
⇒ Transaction Roll Back when Session Ended in MySQL
⇐ Transaction Committed when START TRANSACTION Executed in MySQL
2016-10-17, 2214🔥, 0💬
Popular Posts:
What Happens If the UPDATE Subquery Returns Multiple Rows in SQL Server? If a subquery is used in a ...
How To Connect the Oracle Server as SYSDBA in Oracle? This is Step 4. The best way to connect to the...
What To Do If the StartDB.bat Failed to Start the XE Instance in Oracle? If StartDB.bat failed to st...
How To Present a Past Time in Hours, Minutes and Seconds in MySQL? If you want show an article was p...
What Are the Underflow and Overflow Behaviors on FLOAT Literals in SQL Server Transact-SQL? If you e...