edited by
416 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?
edited by

Please log in or register to answer this question.

Related questions

0 votes
0 votes
1 answer
3
rayhanrjt asked Jan 6, 2023
762 views
Write SQL command to find DepartmentID, EmployeeName from Employee table whose average salary is above 20000.
2 votes
2 votes
1 answer
4
Subhrangsu asked Jun 18, 2022
446 views
Write SQL query to show all employees hired on June 4,1984 (non-default format)emp(empno,ename,job,mgr,hiredate,sal,comm,deptno)