167k views
1 vote
A shared lock is automatically obtained when the SELECT...FOR UPDATE command is executed. a) True b) False

User TatsuDn
by
7.6k points

1 Answer

4 votes

Final answer:

The assertion is false because the SELECT...FOR UPDATE command actually acquires an exclusive lock, not a shared lock, on the selected rows to prevent other transactions from modifying them.

Step-by-step explanation:

The statement is false. In database management, a shared lock is typically obtained to allow multiple transactions to read a database resource but prevent other transactions from writing to the resource concurrently. However, the SELECT...FOR UPDATE command does not result in a shared lock. Instead, this command acquires an exclusive lock or a write lock on the selected rows. The exclusive lock ensures that no other transactions can modify or lock the same rows until the transaction that holds the lock is completed. This is done to prepare the rows for a potential update that the transaction may perform later.

User Suraj Bajaj
by
7.1k points