Reputation: 351
I have a schema that looks like this: Student (sid, name, age, department) Course(cid, name) Enrollment(sid, cid, term, grade)
Using relational calculus, find the names of the students who took all courses. What I have now looks like this:
{t | ∃ s ∈ Student (t.name = s.name ^ ∃ e ∈ Enrollment(s.sid = e.sid ^ ∀ c ∈ C (c.cid = e.cid))) }
Can someone tell me if this is right or not.
Upvotes: 0
Views: 116
Reputation: 10065
Your query isn't correct or well formed. Logical conjunction doesn't range over quantifiers (i.e. you can't write ^ ∀) and even if it did, your expression would try to find all course ids in a single enrollment of a single student.
The correct answer could be stated in English: find all students where there doesn't exist a course for which the student doesn't have an enrollment.
Upvotes: 0