• edited by
920 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,192 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
746
746 views
equimanthorn asked Sep 15, 2023
746 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,807 views
Write SQL command to find DepartmentID, EmployeeName from Employee table whose average salary is above 20000.
2 2 votes
1 1 answer
846
846 views
Subhrangsu asked Jun 18, 2022
846 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)