Transactions

If database servers operated flawlessly 100% of the time, if users always allowed programs to complete execution, and if applications always concluded without fatal errors, there would be nothing to discuss regarding simultaneous access to the database.

However, such an ideal situation is unrealistic, and therefore we must consider mechanisms that allow multiple users to work with the same data. One of the key elements in solving this issue is the transaction.

A transaction is a sequence of database operations that are executed as a single unit.

In this section, we will discuss transactions that allow combining multiple SQL statements into one group, ensuring that either all the statements are successfully executed or none of them are executed.