Understand the concept of a transaction

To understand the concepts of a transaction take an example of CSIT banking database.

Suppose a user transfers money from his/her savings account to his current account the statement will be divided into four blocks:
Debit Saving Account
Credit Current Account
Record in Transaction Journal
End Transaction
The statement to debit SB a/c is as follows:

UPDATE saving_accounts
SET balance = balance – 2000
WHERE account_no = 121 ;

The statement to credit OD a/c is as follows:

UPDATE current_accounts
SET balance = balance + 2000
WHERE account_no = 121 ;

The statement for record in transaction journal is as follows:

INSERT INTO journal VALUES
(122, ‘Tansaction on bank of baroda a/c’, ’23-jan-16′ 541656, 563456, 2000);

The statement for End Transaction is as follows:

COMMIT WORK;