how to save marital relationship in a database

后端 未结 6 1573
说谎
说谎 2021-01-18 11:28

I have to save this information in a database

Person -> is married to -> Person

Where should I save that information? What is the proper design pattern shoul

6条回答
  •  星月不相逢
    2021-01-18 12:01

    I would recommend Following structure Lets say table name is Person.

    1. PersonId (int, Key)
    2. MarriedTo (int, nullable)

    .....

    No need to create foreign key relation ship.

提交回复
热议问题