DBMS Notes

Transaction in Database

  • It is a set of operations use to perform a logical unit of work. For example work is withdraw money. To withdraw money it needs to transaction some amount from one account to other account through ATM or online etc.
  • A transaction generally represents change in database.

How Transaction is actually performed?

As we know, All banks contain their database Server which holds all information’s of their account holders. When it need to transaction then the following basic operations are performed on data.

  • READ: Information’s of sender account are fetched from Hard DISK of DATABASE SERVER to MAIN Memory of Sending Device.
  • WRITE: Now fetched information’s can change according to transaction need though CPU. Still all the changes are in Main memory.
  • In last step, commit command made the permanent changes in database of hard disk server.

Note: Command Rollback: It is use to undo the work done.


Let’s take an example of a simple transaction. Suppose a bank employee transfers Rs. 1000 from A’s account to B’s account. This simple transaction contains several low level mini tasks.

A’s Account

  • Open_Account(A)
  • Old_Balance = A.balance                      // READ (fetch information)
  • New_Balance = Old_Balance – 1000   // ALU operation on data
  • A.balance = New_Balance                    // WRITE (update in main memory)
  • Close_Account(A)                                 // commit (to perform permanent changes in database)

B’s Account

  • Open_Account(B)
  • Old_Balance = B.balance
  • New_Balance = Old_Balance + 1000
  • B.balance = New_Balance
  • Close_Account(B)


Help Other’s By Sharing…

Contact Us

Burewala, Vehari, Punjab, Pakistan


Website: CStaleem.com

Pin It on Pinterest