问题
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