Relational calculus databases

103 Views Asked by At

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.

1

There are 1 best solutions below

1
On

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.