Association between two entries in SQL table

后端 未结 3 1601
没有蜡笔的小新
没有蜡笔的小新 2021-01-01 03:26

Imagine you have a database table that stores a list of people. You want to establish a relationship between peoples, i.e., person I is friend with person J.

I suppo

3条回答
  •  耶瑟儿~
    2021-01-01 04:07

    Yes, this is right if you want to model a many-to-many relation. That is all persons can have many friends.

    If you have a one-to-many relation, like all persons has one boss (or no boss) you don't need the extra table, then you only need a BossId column in the person table.

提交回复
热议问题