Consider the following MySQL table, let's name it MyTable
:
-------------------
| Id | AssignedTo |
-------------------
| 1 | NULL |
| 2 | NULL |
| 3 | NULL |
-------------------
Let's say I have a script, which when accessed, performs the following query:
UPDATE MyTable SET AssignedTo = '@userid' WHERE AssignedTo IS NULL LIMIT 1
The purpose of the script, is to assign an id to a user from the specific table. Is there a possiblity, that if the above mentioned script is called at the exact same time, by two different users, one of the remains without an assigned ID because the two MySQL statements overwrite each other?