1,099 views
0 votes
0 votes

Schema

student (rollNo, name, degree, year, sex, deptNo, advisor)
course (courseId, cname, credits, deptNo)
enrollment (rollNo, courseId, sem, year, grade)

Obtain the names of courses enrolled by student named Mahesh
{c.name | course(c) ^
               (∃s) (∃e) ( student(s) ^ enrollment(e)^ s.name = “Mahesh”^ s.rollNo= e.rollNo^ c.courseId = e.courseId) }

Do we really need (∃s) (∃e) ? Can the query be like:
{c.name | course(c) ^
                enrollment(e) ^
                student(s) ^
                c.courseId = e.courseId ^
                e.rollNo = s.rollNo ^
                s.name = "Mahesh" }

Are both correct?

2 Answers

0 votes
0 votes
i think (a) is correct way

we have two types of variable free and bound

c is a free variable here, and we bound e as well s.
0 votes
0 votes
The second query describes the conditons for all students, for all courses and for all enrollments.

Related questions

1 votes
1 votes
2 answers
2
tarunmaganti asked Apr 15, 2018
748 views
If there are three tables to choose from -Sailors(sid,sname); Reserves(sid,bid); Boats(bid,color)Question is to choose a sailor who reserved a red boat.My question is wha...
0 votes
0 votes
0 answers
4
Tuhin Dutta asked Dec 10, 2017
677 views
What does the following tuple relational calculus query produce?• Student (Student_name, street, city)• Score (Student_name, Branch_name, marks)• Branch (Branch_nam...