Updating foreign key values

后端 未结 3 885
没有蜡笔的小新
没有蜡笔的小新 2021-01-22 20:54

I have a database application in which a group is modeled like this:

TABLE Group
(
  group_id integer primary key,
  group_owner_id integer
)

TABLE GroupItem
(
         


        
3条回答
  •  花落未央
    2021-01-22 21:26

    Does SQL Server not support UPDATE CASCADE? :-

    Foreign Key (group_id, group_owner_id)
     references Group(group_id, group_owner_id)
     ON UPDATE CASCADE
    

    Then you simply update the Group table's group_owner_id.

提交回复
热议问题