Modern Database Management: Chapter 11 Problem and Exercise 3

Whitlock Department Stores runs a multiuser DBMS on a LAN file server. Unfortunately, at the present time, the DBMS does not enforce concurrency control. One Whitlock customer had a balance due of $500.00 when the following three transactions related to this customer were processed at about the same time:
  • Payment of $500.00
  • Purchase on the credit of $100.00
  • Merchandise return (credit) of $50.00
Each of the three transactions read the customer record when the balance was $500.00 (i.e., before any other transactions were completed). The updated customer record was returned to the database in the order shown in the bulleted list above.

a. What balance will be included for the customer after the last transaction was completed?
b. What balance should be included for the customer after the three transactions have been processed?


The solution to the problem

a.

Initial balance in the customer account = $500.00. The last transaction is “Merchandise return (credit) of $50.00”. As each transaction reads the customer record when the balance was $500.00, the last transaction also reads the balance at $500.00. As Merchandise return (credit) $50.00 to the customer account, the amount ($50.00) must be added to the customer account.
Hence, the balance in the customer account after the last transaction was completed is $550.00.

b.

It is given that each transaction read the customer record when the balance was $500.00. Initial balance in the customer account = $500.00. 

First transaction: Payment of $500.00. 
The first transaction read the customer record when the balance was $500.00. Then it performs the transaction of payment of $500.00.

Therefore, the balance in the customer account after the competition of the first transaction is $0.00.


Second transaction: Purchase on the credit of $100.00
The second transaction read the customer record when the balance was $500.00. In the second transaction, the purchase was made on credit. So no amount will be deducted from the customer account balance. Therefore, the balance in the customer account after the competition of the second transaction is $500.00.

Third transaction: Merchandise return (credit) $50.00
The third transaction read the customer record when the balance was $500.00. As Merchandise returns (credit) $50.00 to the customer account, the amount ($50.00) must be added to the customer account.
Therefore, the balance in the customer account after the competition of the third transaction is $550.00.


Post a Comment

Post a Comment (0)

Previous Post Next Post