I mean that when I want to insert a record into MySQL, I first check if it exists.
This is usually used when dealing with user registration, I should check the username submitted whether or not has been registered. I do not want to use a unique index because I have a logical delete in my db.
I try to user select ... for update, but for data not exist, it doesn't work well.