关系代数的自然连接符号,了解关系代数中的自然连接

I have seen that natural join is just combination of selection and cartesian product but in various websites its said to be as combination of projection and cartesian product and both are completely different so which definition should corresponds to it more exactly?

解决方案

There are many different versions of "relational algebra" that differ even in their notion of "relation". There's no one PRODUCT or NATURAL JOIN.

Some versions of the relational algebra have relation headings that are lists of attribute names. PRODUCT outputs an attribute for every input list element. If there's a NATURAL JOIN then its result will be like first doing PRODUCT, then RESTRICTing/SELECTing on equality of pairs of same-named attributes, then PROJECTing out one attribute of each pair. They give the same result when there are no shared attribute names. PRODUCT works for any two inputs but NATURAL JOIN might be undefined when an input has duplicate attribute names.

Some versions of the relational algebra have relation headings that are sets of attribute names. (Elements are unordered & unique.) The result of NATURAL JOIN has a heading that is the union of the input headings. (Tuples have one copy each of the attribute names common to both inputs & one copy each of the attribute names unique to one input.) It returns all tuples with that heading that can be made by combining a tuple from each input table. That is regardless of how many common attribute names there are, including zero. PRODUCT is defined only when the inputs share no attribute names but otherwise acts like NATURAL JOIN. PRODUCT's role is to confirm that you expect that there are no shared attribute names. When all the column names are common, that is a kind of INTERSECTION.

All this is regardless of PKs, UNIQUE, FKs & other constraints.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值