Consider the relation Student (name, sex, marks), where the primary key is shown underlined, pertaining to students in a class that has at least one boy and one girl. What does the following relational algebra expression produce? (Note: is the rename operator).
View worked solution
Answer: D
To understand the relational algebra expression, let's break it down into two parts around the set difference () operator:
1. Left-hand side (LHS):
This retrieves the names of all female students in the class.
2. Right-hand side (RHS):
Here, the relation is joined with a renamed copy of itself. The join condition pairs a female student with a male student whose marks () are greater than or equal to the female student's marks (). Thus, the RHS retrieves the names of female students who have marks less than or equal to at least one male student.
3. Set Difference (LHS - RHS):
Subtracting the RHS from the LHS yields the names of female students who do not have marks less than or equal to any male student. This represents female students whose marks are strictly greater than those of all male students.
Free practice · Your answers on this page are not saved.
