Clear explanation of the “theta join” in relational algebra?

后端 未结 4 1653
鱼传尺愫
鱼传尺愫 2021-02-04 13:04

I\'m looking for a clear, basic explanation of the concept of theta join in relational algebra and perhaps an example (using SQL perhaps) to illustrate its usage.

If I

4条回答
  •  情书的邮戳
    2021-02-04 13:29

    All joins can be thought of as beginning with a cross product and then weeding out certain rows. A natural join weeds out all rows in which columns of the same name in the two tables being joine have different values. An equijoin weeds out all rows in which the specified columns have different values. And a theta-join weeds out all rows in which the specified columns do not stand in the specified relationship (<, >, or whatever; in principle it could be is_prefix_of as a relationship beween strings).

    Update: Note that outer joins cannot be understood this way, because they synthesize information (that is, nulls) out of nothing.

提交回复
热议问题