Connection of relational algebra operations

Source: Internet
Author: User

1. Understanding of the connection: The connection is also called the θ connection, and the connection between R and relationship S is a new connection from the Cartesian product of the two relationships by selecting a tuple that satisfies a certain condition between the attributes. This condition is θ (comparison operator, such as >, <, =).

2. Natural connection: is a special equivalent connection, compares the same group of attributes in two relationships, and removes the duplicate attribute columns in the result, leaving only tuples of the same component in the attribute group.

3. Left connection: On the basis of a natural connection, add a tuple on the left table that does not contain tuples (rows) that are included in the natural connection.

4. Right connection: On the basis of a natural connection, add a tuple on the right table that does not contain tuples (rows) that are contained in a natural connection.

5. Outer connection: Left JOIN + Right connection


Here is an example to illustrate the above connection:

Relationship R

A B C
2 4 6
3 5 7
4 6 8

Relationship S

B C D
4 6 8
5 6 7
4 6 2
6 8 5

The Cartesian product of R and S is

R.a R.b R.c s.b S.c S.d
2 4 6 4 6 8
2 4 6 5 6 7
2 4 6 4 6 2
2 4 6 6 8 5
3 5 7 4 6 8
3 5 7 5 6 7
3 5 7 4 6 2
3 5 7 6 8 5
4 6 8 4 6 8
4 6 8 5 6 7
4 6 8 4 6 2
4 6 8 6 8 5
The relationship R and the common attribute group in the relationship s are B and C, find the tuple of B and C equivalent in Cartesian product, remove the duplicate attribute value, get the following Natural Connection

A B C D
2 4 6 8
2 4 6 2
4 6 8 5

R and S's left Connection: In the control relationship R, tuples 3, 7, 5 are not included in the natural connection, and the tuple is added on the basis of the natural connection, and there are no columns for the attributes to fill null values.

A B C D
2 4 6 8
2 4 6 2
4 6 8 5
3 7 5 Null

R and S's Right Connection: In the control relationship s, tuples 5, 6, 7 are not included in the natural connection, and the tuple is added on the basis of the natural connection

A B C D
2 4 6 8
2 4 6 2
4 6 8 5
Null 5 6 7
R and S's External Connection(r⋈s): Left JOIN + Right connection

A B C D
2 4 6 8
2 4 6 2
4 6 8 5
3 5 7 Null
Null 5 6 7

Note: R (⋈) S, who is in front of who in the rear










Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.