How to relate table with one of many others?

2019-08-28 03:03发布

I am little confused about my db design. I have orders table that may have records from one of many others. So is it OK to relate each tables with 1:1 to orders. Please look at orders domains and hostings table relations.

My orders table rows has either a domain or hosting regarding to its orders_type value.

enter image description here

1条回答
The star\"
2楼-- · 2019-08-28 03:46

Are you asking if the orders should have 1:1 relationship with domains and another 1:1 relationship with hostings? If you are, the answer is no. Your hosting table has an orders_id which implies means that you can have multiple hostings with the same order, i.e., orders:hosting is 1:M.

{Regarding domains, orders:domains => 1:M}

查看更多
登录 后发表回答