STUDINFO
StudID |
Name |
Sex |
S1 |
A |
Male |
S2 |
B |
Female |
S3 |
C |
Female |
Enroll
StudID |
CourseID |
S1 |
C1 |
S2 |
C1 |
S1 |
C2 |
S3 |
C2 |
ALGEBRA : = π courseID ( ( π studID (σ sex="female" ( STUDINFO )) × π courseID ( enroll )) − enroll )
From the highlighted part : We are taking Cartesian product of all FEMALE STUDENTS from STUDINFO table with all COURSES in Enroll Table.
The table will look like:
Cross Product
StudID |
CourseID |
S2 |
C1 |
S2 |
C2 |
S3 |
C1 |
S3 |
C2 |
Then We are subtracting Enroll from above table.
Note: Subtraction of Table P with Table Q contains all the tuples which are in P but not in Q. Example: P = {1,2,3} and Q = {2,3,6} then P - Q = {1}
The resultant Table from Cross Product MINUS Enroll will look like:
Result
StudID |
CourseID |
S2 |
C2 |
S3 |
C1 |
Now we are selecting CourseID from above Table
Selected Courses : C1 and C2
Option A) Courses in which all the female students are enrolled = False because only S2,S1 joined C1 and only S3,S1 joined C2 where S1 is Male.
Option B) Courses in which a proper subset of female students are enrolled. = TRUE
Option C) Courses in which only male students are enrolled.= False because S2 along with S1 also joined C1 and S3 along with S1 also joined C2
Option B is correct.