A database transaction implements the command \"set STATUS to \'CURRENT\' in all
ID: 3801479 • Letter: A
Question
A database transaction implements the command "set STATUS to 'CURRENT' in all records where BALANCE-OWED=0".
(A) Describe how that transaction would be performed with the two-step commit.
(b) Suppose the relations from which the command was formed are (CUSTOMER-ID,STATUS) and (CUSTOMER-ID, BALANCE-OWED). How would the transaction be performed?
(c) Suppose the relations from which that command was formed are (CUSTOMER-ID, STATUS), (CREDIT-ID,CUSTOMER-ID), (CREDIT-ID, BALANCE-OWED). How would the transaction be performed?
Explanation / Answer
Database Transaction
Let the table name be Customer, which has record
A)
BEGIN TranT1;
UPDATE Customer , SET STATUS =’CURRENT’ , WHERE BALANCE-OWED=0 ;
COMMIT TranT1;
//->To implement the transaction , lets begin with the transaction Trant1.
->table is named as customer, the status is set to current ,if the balanced-owes is 0.
->if the update is successful, then transaction is committed.//
B)
UPDATE Customer , SET STATUS =’CURRENT’ , IF BALANCE-OWED=0 WHERE CustomerID=’xxx’;
//It will update the table customer as Status= current, if the Balance-owed=0, where the customerId = ‘xxx’//
C)
UPDATE Customer , SET STATUS =’CURRENT’ , IF BALANCE-OWED=0 WHERE CustomerID=’xxx’ && CreditID=’yyy’ ;
//It will update the table customer as Status= current, if the Balance-owed=0, where the customerId = ‘xxx’ and credit-ID=’yyy’//