1,921 views
0 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 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 0 votes
The second query describes the conditons for all students, for all courses and for all enrollments.
Position:
Show:

Related questions

1 1 vote
2 2 answers
2.6k
2.6k views
Harsh Kumar asked Jul 2, 2018
2,625 views
Relation Schema : Employee (Name, Ssn, Bdate, Address, Dept_number)Project (Pname, Pno, Dept_number)WorksOn (Essn, Pno, Hours)List the names of employees who work on all ...
1 1 vote
2 answers 2 answers
1.4k
1.4k views
tarunmaganti asked Apr 15, 2018
1,399 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 0 votes
1 1 answer
727
727 views
Harsh Kumar asked Jul 1, 2018
727 views
I am not well versed in Predicate calculus and maybe, therefore, I am having problems writing queries in Tuple Relational Calculus and sometimes also in interpreting them...
0 0 votes
0 0 answers
1.1k
1.1k views
Tuhin Dutta asked Dec 10, 2017
1,147 views
What does the following tuple relational calculus query produce?• Student (Student_name, street, city)• Score (Student_name, Branch_name, marks)• Branch (Branch_name, HOD...