edited by
1,747 views
1 votes
1 votes

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 the projects controlled by department number 10.

My Answer : 

$\left \{ e.Name | Employee(e) \land \exists\ p(Project(p) \land p.Dept\_number = 10) \land (\forall p ( \exists w ( worksOn(w) \land w.Pno = p.pno \land w.Essn = e.ssn))) \right \}$

Please confirm if it is correct or not

The solution provided was :

$\left \{ e.Name | Employee(e) \land (\forall x (Project (x) \land x.Dept\_number = 10 )) \to (\exists w)(WorksOn(w) \land w.Essn = e.ssn \land x.Pno = w.Pno) \right \}$

However, I think that it will also print unnecessary values of employee name because for the "implies" part, if the LHS becomes false (may be because x.Dept_number = 5 ), then all of the "implies" part will be evaluated to True and thus those employees name will be printed who work for some project at department no. 5 and not for the department no. 10 ?

edited by

2 Answers

0 votes
0 votes

@Harsh 

in solution provided -Assume atleast one project is controlled by department no. 10 then only this query gives

correct result otherwise it will be very complex to write down such a query .

0 votes
0 votes

Yes you are correct,it is not a safe query. for it to be correct the implies should exclude employee(e) as below.

{e.Name|Employee(e)∧((∀x(Project(x)∧x.Dept_number=10))→(∃w)(WorksOn(w)∧w.Essn=e.ssnx.Pno=w.Pno))}

Related questions

1 votes
1 votes
2 answers
1
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
3
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...
0 votes
0 votes
0 answers
4
Tuhin Dutta asked Dec 10, 2017
343 views
Student (Student_name, street, city)• Score (Student_name, Branch_name, marks)• Branch (Branch_name, HOD)• Manages (Student_name, Faculty_name)What does the followi...