edited by
21,053 views
98 votes
98 votes

Information about a collection of students is given by the relation $\text{studInfo(}\underline{\text{studId}},\text{ name, sex)}$. The relation $\text{enroll(}{\text{studId}},{\text{ courseId}})$ gives which student has enrolled for (or taken) what course(s). Assume that every course is taken by at least one male and at least one female student. What does the following relational algebra expression represent?

$\pi _{courceId}\left(\left(\pi_{\text{studId}}\left(\sigma_{sex='female'}\left(\text{studInfo}\right)\right) \times \pi_{courseId}\left(\text{enroll}\right)\right) -\text{enroll}\right)$

  1. Courses in which all the female students are enrolled.
  2. Courses in which a proper subset of female students are enrolled.
  3. Courses in which only male students are enrolled.
  4. None of the above
edited by

13 Answers

0 votes
0 votes
First it selects all the female students.

Next it takes the studids of all the female students present.

Then it cross with all the courseid s present, which creates extra records which are the tuples where some female students not enrolled for some courses.

When we set difference the two sets, the extra records that is the tuples, in which, course IDs are presentwhich are not enrolled by some-some females.

Here is the catch - if some course is not enrolled by some female, it may have been enrolled by some other female as it is mentioned in the question that at least one male and female for each course must be enrolled.

Therefore we can understand the course IDs which we will get as result is enrolled by some female which is the proper subset of females, also it can be 'fi' if all females enrolled for all courses.

So, Option B is correct
0 votes
0 votes
I think the answer is option B, I am not going to describe everything but I will say this, see where we subtract cross product result with the actual result, now here is the catch say one female student has enrolled into every subject will she be appearing on the list, No because when taking the cross product with female std if and all the subjects and subtracting with set where a female has taken all subjects will cancel and we will not the get of female students who have taken all courses but only I'd of female STDs who have take only a subset of courses, hope this helps you out 🙂
–2 votes
–2 votes
proper subset means subset not equal to set itself.......so above relational algebra is going to give all courses that "all girls have not taken"
Answer:

Related questions