如何将表与其他众多表之一关联? [英] How to relate table with one of many others?

查看:86
本文介绍了如何将表与其他众多表之一关联?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对数据库设计有点困惑。我有 orders 表,其中可能有许多其他记录之一。因此,可以将每个表以1:1关联到 orders 。请查看订单 主机表之间的关系。 / p>

我的订单表行具有托管与其 orders_type 值有关。



解决方案

您是否在问订单是否应该与域名具有1:1关系,而与托管又应具有1:1关系?如果是,答案是否定的。您的托管表中包含一个orders_id,这意味着您可以拥有多个具有相同订单的托管,即orders:hosting为1:M。



{关于域名,订单:domains => 1:M}


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.

解决方案

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}

这篇关于如何将表与其他众多表之一关联?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆