19.8k views
3 votes
For the following two transactions and the initial table values as shown complete the missing blanks in the transaction log below:

Part_ID

Desrption

OnHand

OnOrder

57

Assembled Foo

5

0

987

Foo Fastener

12

7

989

Foo Half

7

0

BEGIN TRANSACTION;

UPDATE Part SET OnHand = OnHand + 7, OnOrder = OnOrder – 7 WHERE Part_ID = 987;

COMMIT;

BEGIN TRANSACTION;

UPDATE Part SET OnHand = OnHand - 4 WHERE Part_ID = 987;

UPDATE Part SET OnHand = OnHand - 2 WHERE Part_ID = 989;

UPDATE Part SET OnHand = OnHand + 1 WHERE Part_ID = 57;

COMMIT

TRL_ID

TRX_ID

PREV_PTR

NEXT_PTR

OPERATION

TABLE

ROW ID

ATTRIBUTE

BEFORE VALUE

AFTER VALUE

1787

109

NULL

START

****

1788

109

1787

UPDATE

PART

987

OnHand

12

1789

109

UPDATE

PART

987

OnOrder

7

1790

109

NULL

COMMIT

****

1791

110

NULL

START

****

User Tomasz Rup
by
4.6k points

1 Answer

5 votes

Answer:

Check the explanation

Step-by-step explanation:

First transaction:

UPDATE Part SET OnHand = OnHand + 7, OnOrder = OnOrder – 7 WHERE Part_ID = 987;

For the part id 987, update OnHand by adding 7 to OnHand and update OnOrder by subtracting 7 from OnOrder.

The current value of OnHand is 12. The current value of OnOrder is 7. After execution of first transaction, the new value of OnHand is 19 and the new value of OnOrder is 0.

Second transaction:

UPDATE Part SET OnHand = OnHand - 4 WHERE Part_ID = 987;

The current value of OnHand for Part_ID = 987is 19. After the update operation, the new value is 15.

UPDATE Part SET OnHand = OnHand - 2 WHERE Part_ID = 989;

The current value of OnHand for Part_ID = 989 is 7. After the update operation, the new value is 5.

UPDATE Part SET OnHand = OnHand + 1 WHERE Part_ID = 57;

The current value of OnHand for Part_ID = 57 is 5. After the update operation, the new value is 6.

The final transaction log after the two transactions can be seen in the attached image below:

For the following two transactions and the initial table values as shown complete-example-1
User Jordan Parmer
by
4.3k points