Skip to content
Official PYQ · 2007

GATE CS 2007 Q59 — Relational Model: Relational Algebra

Explain with AI

Information about a collection of students is given by the relation studInfo(studId‾, name, sex)\text{studInfo(}\underline{\text{studId}},\text{ name, sex)}. The relation enroll(studId, courseId)\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?

πcourceId((πstudId(σsex=′female′(studInfo))×πcourseId(enroll))−enroll)\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)

Choose one option
View worked solution

Answer: B

Let us break down the relational algebra expression step-by-step:

  1. πstudId(σsex=′female′(studInfo))\pi_{studId}\left(\sigma_{sex='female'}\left(\text{studInfo}\right)\right): This retrieves the set of all female student IDs, say FF.
  2. πcourseId(enroll)\pi_{courseId}\left(\text{enroll}\right): This retrieves the set of all course IDs, say CC.
  3. F×CF \times C: This represents the Cartesian product containing all possible pairs of (female student, course)\text{(female student, course)}.
  4. (F×C)−enroll(F \times C) - \text{enroll}: This yields the pairs of (female student, course)\text{(female student, course)} where the female student is not enrolled in that course.
  5. πcourseId(… )\pi_{courseId}(\dots): Projecting the course IDs from the above difference gives the courses in which at least one female student is not enrolled.

We are given that every course is taken by at least one female student. Therefore, for any course returned by this expression:

  • The set of enrolled female students is not empty (at least one female is enrolled).
  • The set of enrolled female students is not the entire set FF (at least one female is not enrolled).

Thus, the enrolled female students for these courses form a non-empty proper subset of all female students. This matches Option B.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Relational Model: Relational Algebra questions