• edited by
916 views
2 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?

Please log in or register to answer this question.

Position:
Show:

Related questions

1 1 vote
1 answers 1 answer
1.2k
1.2k views
tishhaagrawal asked Dec 16, 2023
1,181 views
My doubt here is, if NOT EXISTS gets an empty set as the input then every tuple of the table in the outer query must satisfy the condition. Am I right?For example, in the...
2 2 votes
1 1 answer
742
742 views
equimanthorn asked Sep 15, 2023
742 views
A SQL query is written in its format as clauses are arranged in a specific sequence and these clauses are executed in different sequence. If we’re writing a query using s...
0 0 votes
1 1 answer
1.8k
1.8k views
rayhanrjt asked Jan 6, 2023
1,797 views
Write SQL command to find DepartmentID, EmployeeName from Employee table whose average salary is above 20000.
2 2 votes
1 1 answer
844
844 views
Subhrangsu asked Jun 18, 2022
844 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)