Division operations in Relational algebra

Source: Internet
Author: User


The concept of the description of the very abstract, just beginning to learn the students completely unintelligible. Here, an example is given to illustrate the process of solving the division operation.

With the relationship R, S, the result of seeking R÷s

Solution Step Procedure:
The first step: find the Relationship R and the same attribute in the relationship s, that is, the Y property. Make a projection of y in relation s (to be taken out of the Y column), and the result is as follows

The second step: the attribute column in the R that is not the same as in S is X, and the relationship R does a projection of the de-duplicated value on the attribute (X) to {x1,x2};
Step three: Find the X attribute of the relationship r in the corresponding image set Y

                  

According to the records of the relationship R, the records related to the X1 value can be obtained, as shown in 3; records related to X2, as shown in Figure 4

Fourth step: Judging the inclusion relationship
R÷s is actually determining whether the set Y of x values in the relationship R contains all the values of the attribute y in the relationship s. Compare to discover:
The X1 image set is only Y1 and cannot contain all the values of the attribute y in the relationship s, so the X1 is ruled out;
And X2 's image set contains all the values of attribute y in relation s, so the r÷s end result is X2,

Maybe now you know a little bit about how the division operation is done, so let's take a look at what the division can solve.
Take a look at the following small example:
With relationship R,s and RS, for rs÷s results

It's easy to get the result: {Zhang San}

So you can easily see that the problem that rs÷s is solving here is: "Students who have enrolled in all courses."
The meaning of Rs÷s is: "In the contact RS of R and S, find the R tuples that are related to all tuples in S."

Division operations in Relational algebra

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.