The Gateway to Computer Science Excellence

First time here? Checkout the FAQ!

x

+1 vote

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.

Answer:

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 !

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.

Answer:

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 !

0 votes

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

- All categories
- General Aptitude 1.8k
- Engineering Mathematics 7.3k
- Digital Logic 2.9k
- Programming & DS 4.9k
- Algorithms 4.3k
- Theory of Computation 6k
- Compiler Design 2.1k
- Databases 4.1k
- CO & Architecture 3.4k
- Computer Networks 4.1k
- Non GATE 1.4k
- Others 1.4k
- Admissions 596
- Exam Queries 577
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 18

49,534 questions

54,122 answers

187,321 comments

71,040 users