Posts

Transaction

1 min read

 A transaction is an action or series of actions that are being performed by a single user or application program, which reads or updates the contents of the database.

A transaction can be defined as a logical unit of work on the database. This may be an entire program, a piece of a program, or a single command (like the SQL commands such as INSERT or UPDATE), and it may engage in any number of operations on the database. In the database context, the execution of an application program can be thought of as one or more transactions with non-database processing taking place in between.

EXAMPLE-

A simple example of a transaction will be dealing with the bank accounts of two users, let say Karlos and Ray. A simple transaction of moving an amount of 5000 from Karlos to Ray engages many low-level jobs. As the amount of Rs. 5000 gets transferred from the Karlos's account to Ray's account, a series of tasks gets performed in the background of the screen.

This straightforward and small transaction includes several steps: decrease Karlos's bank account from 5000:

Open_Acc (Karlos)

OldBal = Karlos.bal

NewBal = OldBal - 5000

Ram.bal = NewBal

CloseAccount(Karlos)

You can say, the transaction involves many tasks, such as opening the account of Karlos, reading the old balance, decreasing the specific amount of 5000 from that account, saving new balance to an account of Karlos, and finally closing the transaction session.

For adding amount 5000 in Ray's account, the same sort of tasks needs to be done:

OpenAccount(Ray)

Old_Bal = Ray.bal

NewBal = OldBal + 1000

Ahmed.bal = NewBal

CloseAccount(B)



You may like these posts

  •  Functional dependenciesA functional dependency is a constraint that specifies the relationship between two sets of attributes where one set can accurately determine the value…
  •  Query List 1. Query to display Employee Name, Job, Hire Date, Employee Number; for each employee with the Employee Number appearing first.  Query:  …
  •  Query List11. Query to display the Name, Salary and Commission for all the employees who earn commission. Sort the data in descending order of Salary and Commission. Q…
  •   Database Questions and Answers – Functional-Dependency Theory – Algorithms for Decomposition1.Suppose relation R(A,B,C,D,E) has the following functional dependencies:A …
  •  This set of Database Multiple Choice Questions & Answers (MCQs) focuses on “Database Design Process”.1. _____________ can help us detect poor E-R design.a) Database Desig…
  •  Query List6. Query to display Employee Name and Department Number for the Employee No = E90. Query: Select Ename, Dno from EMPLOYEE where Eno='E90'; Output:7.…

Post a Comment

© 2025DBMS. The Best Codder All rights reserved. Distributed by