Sunday , June 16 2024

What is Transaction in MySQL

In the article, I will explain What is Transaction in MySQL. Also, article contains information about the use of Transaction, which is frequently used in systems such as SQL Server, Oracle etc..

What is Transaction in MySQL?

Transaction is a feature that allows database management systems to perform transactions according to ACID rules Transaction provides integrity, consistency, independence and durability in ACID rules. Thus, data is restored when errors occur during any change.

Transaction usage in MYSQL

The INNODB storage engine is used to use the Transaction feature with MySQL. Let’s create the products table where the products are stored.


One of the following is applied to start the transaction.


SQL commands executed after the Transaction feature is started cannot perform any inserts, deletes or updates on the table.

The transactions performed are temporarily stored in memory.

COMMIT and ROLLBACK Transaction in MySQL

To reflect the transactions performed within the transaction to the table, below command is used.

To rollback the transactions performed within the transaction, below command is used.

The Transaction feature is mostly used within MySQL stored procedures with the MySQL if statement for error checking. With the MySQL if statement, errors are checked, and as a result, transactions are committed to the table or rolled back.

I wish you a good day.


About Yusuf SEZER

Leave a Reply

Your email address will not be published. Required fields are marked *