Multiple foreign keys to a single column

后端 未结 7 2240
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-14 16:41

I\'m defining a database for a customer/ order system where there are two highly distinct types of customers. Because they are so different having a single customer table wo

7条回答
  •  青春惊慌失措
    2020-12-14 17:35

    A foreign key can only reference a single primary key, so no. However, you could use a bridge table:

    CustomerA <---- CustomerA_Orders ----> Order
    CustomerB <---- CustomerB_Orders ----> Order
    

    So Order doesn't even have a foreign key; whether this is desirable, though...

提交回复
热议问题