+1 vote
326 views
Example Relational Scheme
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:

Determine the students who are enrolled for every
course taught by Prof Ramanujam. Assume that Prof
Ramanujam teaches at least one course.

1. {s.rollNo | student (s) ^
2. (∀c)(course (c) ^
3. ((∃t),(∃p)( teaching(t) ^ professor(p) ^
4. t.courseId = c.courseId ^
5. p.name = “Ramanujam” ^
6. p.empId = t.empId )) →
7. (∃e) (enrollment(e) ^
8. e.courseId = c.courseId ^
9. e.rollNo = s.rollNo)
10. )
11. }

Please explain the answer, i am little bit confused with how relation calculus express divide operator.

(My belief if that ∀ is similar to the quotient operator. ) TIA !
edited | 326 views

As you have mentioned in the question, this is a relational calculus expression and not a relational algebra one. Relational algebra contains only algebraic operations and proportional logic. But relational calculus can contain free and bound variables as seen here.

$\forall$ means FORALL $\exists$ means EXISTS as in Mathematical logic

1. {s.rollNo | student (s) ^
2. (∀c)(course (c) ^
3. ((∃t),(∃p)( teaching(t) ^ professor(p) ^
4. t.courseId = c.courseId ^
5. p.name = “Ramanujam” ^
6. p.empId = t.empId )) →
7. (∃e) (enrollment(e) ^
8. e.courseId = c.courseId ^
9. e.rollNo = s.rollNo)
10. )
11. }
This says that for all courses taught by Ramanugan if there exists a student who has enrolled for it, then return his id. If you go through each line carefully you can get this.

Relational Algebra and relational calculus:
http://www.cs.virginia.edu/~son/cs662.s06/ch4m.ppt