Last modified on April 17th, 2020
Database transaction, Examples, Difference between Commit and Rollback, transaction properties
In this tutorial, we will learn about the followings;
- Database transaction
- Examples of Database transaction
- Difference between Commit and Rollback
- Transaction properties
What is Database transaction?
The transaction is a collection of one or more operations that must be completed together to perform a successful operation. A transaction can be a successful transaction if it all operations are successfully completed. Similarly, a transaction can fail if all operation in a transaction or not completed together and successfully.
Give the examples of database transaction?
- Money transfer from one account to another account involves two operations of a transaction, that are as follows;
- Money is deducted from account 1 and successfully transferred to account 2.
- Money is deducted from account 1 but not successfully transferred to account 2.
Difference between Commit and Rollback:
Commit: A successful transaction is said to be committed.
Rollback: If a transaction is not a successful transaction than it should be rolled back.
Keeping in view the above example, if money is deducted from account 1 but not successfully transferred to account 2, then rollback undo the work done in the previous transaction. It means that deducted money from account 1 is again rollback or transferred to account 1.
What are transaction properties?
Following are the transaction properties;
What is transaction atomicity?
A transaction should be atomic. It means that a transaction should be successfully completed 100%, and if any transaction is not successfully completed 100%, then it should be rollback or Undo.
Give an example of transaction atomicity?
- Keeping in view the above example, if money is deducted from account 1 but not successfully transferred to account 2, then rollback undo the work done in the previous transaction. It means that deducted money from account 1 is again rollback or transferred to account 1.
What is transaction Isolation?
All transactions or operations of transactions that are performed on data and modify the data, then such kind of transactions or operations of transactions should be isolated from each other.
What is transaction consistency?
Transaction consistency means that all transactions after completing the operation leave the data in a genuine consistent state.
What is transaction durability?
According to transaction durability, all changes done by a transaction are permanent. If some changes in data are done by initial half transaction and the system is rebooted or crashed, data should be completed, when the computer starts.
- 5 Best Places to Study Engineering - March 19, 2021
- How Students Can Pick a Good Custom-Paper Writing Service? - March 5, 2021
- List of Public service commissions - August 31, 2020