Collections:
Start a New Transaction Explicitly in MySQL
How To Start a New Transaction Explicitly in MySQL?
✍: FYIcenter.com
If you are confused on the implicit new transaction rules, you can always start a new transaction with the "START TRANSACTION" command to start a new transaction explicitly. "START TRANSACTION" command works in both "Autocommit On" and "Autocommit Off" modes.
The following tutorial exercise shows you how to start a transaction explicitly:
>\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 ('fyicenter.com', 101); Query OK, 1 row affected (0.11 sec) mysql> INSERT INTO fyi_links (url, id) VALUES ('centerfyi.com', 110); Query OK, 1 row affected (0.00 sec) mysql> SELECT * FROM fyi_links; +-----+---------------+-------+--------+-------------------- | id | url | notes | counts | created +-----+---------------+-------+--------+-------------------- | 101 | fyicenter.com | NULL | NULL | 2006-07-01 20:27:49 | 110 | centerfyi.com | NULL | NULL | 2006-07-01 20:28:10 +-----+---------------+-------+--------+-------------------- 2 rows in set (0.07 sec) mysql> ROLLBACK; Query OK, 0 rows affected (0.07 sec)
⇒ Commit the Current Transaction in MySQL
⇐ Show the Current Transaction Mode in MySQL
2016-10-17, 1402🔥, 0💬
Popular Posts:
How To Locate and Take Substrings with CHARINDEX() and SUBSTRING() Functions in SQL Server Transact-...
How To Convert Numeric Expression Data Types using the CONVERT() Function in SQL Server Transact-SQL...
Can Date and Time Values Be Converted into Integers in SQL Server Transact-SQL? Can date and time va...
What Happens If the UPDATE Subquery Returns Multiple Rows in SQL Server? If a subquery is used in a ...
How to download and install Microsoft SQL Server Management Studio Express in SQL Server? Microsoft ...