How to model a Many to many-relationship in code?

前端 未结 12 2009
星月不相逢
星月不相逢 2020-12-05 07:12

Suppose I have 2 tables in a database. eg: Dog & Boss This is a many to many relationship, cause a boss can have more than 1 dog, and a dog can have more than 1 owner. I

12条回答
  •  情书的邮戳
    2020-12-05 07:33

    Not sure on what your asking for. But this is the table structure you want:

    Dog Table

    DOG_ID int PK DOG_Name varchar(50)

    DogsPerBoss

    ID int DOG_ID int BOSS_ID int DogNickName varchar(15)

    Boss

    BOSS_ID int PK BOSS_Name varchar(50)

提交回复
热议问题