in Databases edited by
419 views
2 votes
2 votes
Consider the following database table :

         $Emp(\underline{Eid}, Ename, age)$

         $Project(\underline{Pid}, Pname,budget)$

         $Works for(\underline{Eid Pid})$

Select $Eid$

from $Emp$ $E$

where $age > 30$ and not Exists  $(select$ $Pid$

                                                            $\text{From project P}$

                                                            $\text{where Pname = 'database' and not exist  (select Pid}$

                                                                                                                                              $\text{from works W}$

                                                                                                                                              $\text{where W.Eid = E.Eid}$

                                                                                                                                              $\text{and W.Pid = P.Pid))}$

What does the following query return?
More specifically, what does the inner most query do? Would it run only for those eid with age>30 and pid="database" or for all of them?
in Databases edited by
by
419 views

4 Comments

yes...i missed that ...age>30....

and i'm not getting that how to help u in this....but try this...

first of all read the inner query ....

here they are selecting all the project name database and employee working for all that project...and not considering them...means 

S1. negation of (employee workjing for all the project name database having age>30)

and now come to outer query....

again they are making the negation of abouve statement ...

negation of (S1)...

S1 ((employee working for all the project name database having age>30)

....

1
1
I was making a stupid mistake !! :P
Thanks a lot for your efforts :)
0
0
These all are correlated subqueries right ? For one tuple of employee relation we would check combinations of project and works for relations. Just to check my understanding !
0
0

Please log in or register to answer this question.

Related questions