What\'s the common way to deal with concurrent updates in an SQL database ?
Consider a simple SQL schema(constraints and defaults not shown..) like
c
For the first scenario you could add another condition in the where-clause to make sure you won't overwrite changes made by a concurrent user. E.g.
update credits set creds= 150 where userid = 1 AND creds = 0;