How to relate table with one of many others?

蹲街弑〆低调 提交于 2019-12-13 20:56:59

问题


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.


回答1:


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}



来源:https://stackoverflow.com/questions/19080192/how-to-relate-table-with-one-of-many-others

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!