Multiple foreign keys to a single column

后端 未结 7 2227
佛祖请我去吃肉
佛祖请我去吃肉 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:36

    You can create a foreign key referencing multiple tables. This feature is to allow vertical partioining of your table and still maintain referential integrity. In your case however, this is not applicable.

    Your best bet would be to have a CustomerType table with possible columns - CustomerTypeID, CustomerID, where CustomerID is the PK and then refernce your OrderID table to CustomerID.

    Raj

提交回复
热议问题