0

我是关系代数的新手。我*在以下表达式中找到了运算符

在此处输入图像描述

这个和一个使用 join 有什么不同

在此处输入图像描述

4

2 回答 2

6

The * should more correctly be written × as it represents a Cartesian product. This operation returns the set of all tuples that are the concatenation of tuples from each operand. A join filters the Cartesian product down to only those tuples with matching values on specified attributes. If the join is a natural join, as in your example, the attributes matched on are those with identical names.

For example, given the following two relations R and S as shown:

R ( a, b, c )      S ( b, c, d )
  ( 1, 2, 3 )        ( 2, 7, 9 )
  ( 2, 4, 6 )        ( 5, 3, 4 )
  ( 3, 6, 9 )        ( 2, 3, 6 )

The Cartesian product R × S is:

  ( R.a, R.b, R.c, S.b, S.c, S.d )
  ( 1,   2,   3,   2,   7,   9   )
  ( 1,   2,   3,   5,   3,   4   )
  ( 1,   2,   3,   2,   3,   6   )
  ( 2,   4,   6,   2,   7,   9   )
  ( 2,   4,   6,   5,   3,   4   )
  ( 2,   4,   6,   2,   3,   6   )
  ( 3,   6,   9,   2,   7,   9   )
  ( 3,   6,   9,   5,   3,   4   )
  ( 3,   6,   9,   2,   3,   6   )

The natural join R ⨝ S is the product filtered to only tuples where the b and c values match:

  ( a, b, c, d )
  ( 1, 2, 3, 6 )

The join R ⨝<sub>b S is the product filtered to only tuples where the b values match:

  ( R.a, b,   R.c, S.c, S.d )
  ( 1,   2,   3,   7,   9   )
  ( 1,   2,   3,   3,   6   )
于 2013-11-02T10:03:13.857 回答
1

在少数书籍中,自然连接用 astric(*) 表示。

于 2022-02-10T03:52:36.890 回答