I am using the following syntax to insert new records (I don't want to have duplicate keys):
insert into tbl(key) values select max(key)+1 from tbl
Someone says it will have concurrency problem.
Is that right?
SELECT -> LOCK table -> INSERT
or
LOCK table -> SELECT -> INSERT
Which one of the above is correct?