这两个关系对联合操作是否兼容? [英] Are these two relations compatible for a union operation?

查看:78
本文介绍了这两个关系对联合操作是否兼容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定以下两个关系是否适用于联合:

I'm not sure if the following two relations are compatible for a union:

R: <- schema name
B
1
2
2
3
3

并且:

Q: -< schema name
A  B
5  1
6  1
4  2
3  4

我想参加工会:QUR。可以吗?结果是什么?

I want to do the union: Q U R. Can I? What's the result?

推荐答案

联合运算符要求两个关系都必须兼容联合。这意味着它们必须具有相同的属性集。请注意,此概念比共享相同数量的属性略有超出。这是因为它还考虑了属性的内容。

The union operator requires that both relations are union-compatible. This means that they are required to have the same set of attributes. Note that this concept goes slightly beyond than sharing the same amount of attributes. This is because it also considers the content of the attribute.

这并不意味着两个属性应具有相同的名称,而是两个属性都应具有相同的名称,而我在这个例子中,m真正脱离关系代数,具有类似的数据类型。关系代数中没有这样的东西,但我认为,如果您具有编程背景,则可以通过思考该概念轻松地掌握它。

This doesn't mean that both attributes should have the same name but rather that both attributes should, and I'm really walking away from relational algebra with this example, have a similar "data type". There is no such a thing in relation algebra but I think that if you have a programming background you'll easily get it by thinking on that concept.

EG:考虑一下以下关系:

EG: Consider the following relations:


  • 人员(名字,姓氏)

  • 国家/地区(名称,人口)

  • Person(FirstName, LastName)
  • Country(Name, Population)

在这种情况下,人和国家/地区与工会不兼容即使它们共享相同数量的属性,也不会共享相同的属性。

In this case, Person and Country are not union-compatible as they do not share the same set of attributes, even though they share the same amount of attributes.

这篇关于这两个关系对联合操作是否兼容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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