medium
Single Answer
0

Referring to the database transaction shown here, what would happen if no account exists in the Accounts table with account number 1001?

Answer Options

A

The database would create a new account with this account number and give it a $250 balance.

B

The database would ignore that command and still reduce the balance of the second account by $250.

C

The database would roll back the transaction, ignoring the results of both commands.

D

The database would generate an error message.

Correct Answer: B

Explanation

In this example, the two SQL commands are indeed bundled in a transaction, but it is not an error to issue an update command that does not match any rows. Therefore, the first command would succeed in updating zero rows and not generate an error or cause the transaction to roll back. The second command would then execute, reducing the balance of the second account by $250.

View Reference Material