Enforcing “zero-or-one to one” relationship on SQL database?

后端 未结 4 2093
一整个雨季
一整个雨季 2021-01-06 11:53

I have a Post entity and a FbPost entity.

Post.FbPost is either null or a FbPost, and no two Post en

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-06 12:28

    NULL able gives you the 0... a UNIQUE CONSTRAINT on your FK reference will give you the 1.

提交回复
热议问题