edited by
20,996 views
97 votes
97 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

12 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
–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"
–3 votes
–3 votes

(piesex=female(studid))cross piecourseid(enroll) it gives relation with four attribute(studid,name,sex,enrollid) but it contains only information about female

and if we subtract enroll relTION FROM IT THEN IN SUBSTRACTION ONLY THOSE TUPLES WILL EXTRACTED WHICH ARE NOT IN (ENROLL) but enroll have all because it is original relation so it gives nothing so (d) will be answer 

Answer:

Related questions