It is somewhat confusing to me when to use quantifiers in tuple relational calculus (TRC). I stumbled upon following problem and I am still scratching my head thinking why not TRC query can be constructed without using existential quantifier.
The given problem reads like this:
Relations:
student (rollNo, name, degree, year, sex, deptNo, advisor)
department (deptId, name, hod, phone)
professor (empId, name, sex, startYear, deptNo, phone)
course (courseId, cname, credits, deptNo)
enrollment (rollNo, courseId, sem, year, grade)
teaching (empId, courseId, sem, year, classRoom)
preRequisite(preReqCourse, courseID)Question: Obtain the names of courses enrolled by student named "Roger".
Given solution:
{ c.name | course(c) ^
(∃s) (∃e) ( student(s) ^
enrollment(e) ^
s.name = “Roger” ^
s.rollNo= e.rollNo ^
c.courseId = e.courseId}
Why I cant just have following? :
{c.name | course(c) ^
enrollment(e) ^
student(s) ^
c.courseId = e.courseId ^
e.rollNo = s.rollNo ^
s.name = "Roger" }