How to deal with concurrent updates in databases?

后端 未结 9 1687
名媛妹妹
名媛妹妹 2020-11-27 12:24

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         


        
9条回答
  •  醉梦人生
    2020-11-27 13:14

    If you store a last update timestamp with the record, when you read the value, read the timestamp as well. When you go to update the record, check to make sure the timestamp matches. If someone came in behind you and updated before you, the timestamps would not match.

提交回复
热议问题