31.3k views
4 votes
The SELECT...FOR UPDATE command will automatically obtain a(n) ____________________ lock on the row to be changed.

A) Shared
B) Exclusive
C) Read
D) Write

1 Answer

3 votes

Final answer:

The SELECT...FOR UPDATE command obtains an exclusive lock on the row, ensuring no other transaction can modify it simultaneously. This type of lock is used to prevent other transactions from reading or writing to the same row until the transaction that holds the lock is completed.

Step-by-step explanation:

The SELECT...FOR UPDATE command will automatically obtain a exclusive lock on the row to be changed. This type of lock is used to prevent other transactions from reading or writing to the same row until the transaction that holds the lock is completed. This is necessary to maintain data consistency during an update and to prevent situations known as 'lost updates' where two transactions might attempt to modify the same data concurrently.

User Eudel
by
8.6k points