Databases · Middle · Question 19 of 75
What does SELECT ... FOR UPDATE do?
- 1Updates the selected rows automatically
- 2Selects rows that were updated recently
- ✓Correct answer: Locks the selected rows until the transaction ends, so other transactions can't change or lock them for update
Explanation
Other writers wait. Keep such transactions short, and lock rows in a consistent order to avoid deadlocks.