A transaction is a logical unit of work that contains one or more SQL statements. A transaction is an atomic unit. A database transaction must be atomic, meaning that it must be either entirely completed or aborted. Ideally, a database System will guarantee the properties of Atomicity, Consistency, Isolation and Durability (ACID) for each transaction. The effects of all the SQL statements in a transaction can be either all committed or all rolled back. The description of both states are given below:-

  • Committing Transaction means that a user has explicitly or implicitly requested that the changes in the transaction be made permanent. An explicit request means that the user issued a COMMIT statement. An implicit request can be made through normal termination of an application or in data definition language, for example. The changes made by the SQL statements of your transaction become permanent and visible to other users only after your transaction has been committed. Only other users' transactions that started after yours will see the committed changes.

  • Rollback Transaction erases all data modifications made since the start of the transaction or to a save point. It also frees resources held by the transaction.

A transaction begins with the first executable SQL statement. A transaction ends when it is committed or rolled back, either explicitly with a COMMIT or ROLLBACK statement or implicitly when a DDL statement is issued. Let’s take an example of a banking database. When a bank customer transfers money from a savings account to a checking account, the transaction can consist of three separate operations:

  • Decrement the savings account

  • Increment the checking account

  • Record the transaction in the transaction journal.

Read and write operations
A transaction includes one or more database access operations like insertion, deletion, modification, or retrieval operations. If the database operations in a transaction do not update the database but only retrieve data, the transaction is called a read-only transaction. And if the transactions insert and update data then it is called write transaction.


Database Discussion


Database Source Code


Database Related Tutorials


New Database Resources


Copyright © 2015 VisualBuilder. All rights reserved