Concept of database transaction- A transaction is a logical
unit of work (LUW). It involves one or more DML statements. Such as insert,
delete or update and ends with either commit to make the changes permanent or
rollback to undo the changes.
So database transactions must be handled in a way so that
their integrity is maintained
Transaction properties- to ensure data integrity database
system maintain the following properties of the transaction often termed as
acid properties.
1. Atomicity- (All or none concept) this property ensure
that either all operations of the transaction are reflected properly in the
database or none.
This property has two states Done or Never started
Done state- it means a transaction must complete successfully
and its effect should be visible in a database.
Never started state- it means if a transaction fails during
execution then its all modification must be undone i.e. remove the effect of
failed transaction.
2. Consistency- This property indicates that if the database
was in a consistent state before the start of execution than upon termination
of transaction the database will also be in a consistent state.
3. Isolation- This property indicates that each transaction
is unaware of another transaction. It indicates that action performed by a
transaction will be hidden or isolated from outside the transaction until the
transaction terminates.
4. Durability- This property of a transaction ensures that
after the successful completion of transaction the changes made by it to the
database persists even if there are system failures
Together these four properties of transaction are often
called acid properties.