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

  •  View of data in DBMSAbstraction is one of the main features of database systems. Hiding irrelevant details from user and providing abstract view of data to users, helps in ea…
  • Entity, Entity Type, Entity Set – An Entity may be an object with a physical existence – a particular person, car, house, or employee – or it may be an object with a conceptua…
  •  Generalization, Specialization and Aggregation in ER ModelGeneralization – Generalization is the process of extracting common properties from a set of entities and creat…
  •  Types of DatabasesThere are various types of databases used for storing different varieties of data:1) Centralized DatabaseIt is the type of database that stores data at a ce…
  •  ConstraintsIntegrity constraints are a set of rules. It is used to maintain the quality of information.Integrity constraints ensure that the data insertion, updating, and oth…
  •  ER modelER model stands for an Entity-Relationship model. It is a high-level data model. This model is used to define the data elements and relationship for a specified syste…

Post a Comment

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