search
Log In
0 votes
232 views

 

in Databases 232 views
0
I got option D can't be the Answer Please Help me with option A and B
0
C should be the answer
1
I am getting option b
0
can we use columns of main query in sub-query without prefixing the table?

2 Answers

2 votes
$\text{answer should be b)}$$$\text{NOT EXISTS returns TRUE if there are no tuples in the result of nested query , and it returns }$$$\text{FALSE otherwise.}$

$\text{first subquery selects allprojects controlled by department 5, and the second subquery}$
$\text{selects all projects on which particular employee is working and the }$
$\text{difference of the first subquery result EXCEPT the second subquery result is }$
$\text{empty, it means that the employee works on all the projects and is therefore selected.}$
0
Answer is Correct. But Please Elaborate :)

I got that in option B inner query will be Empty. But how its giving the answer i dont understand ??

Please elaborate on option A too
2 votes

$\text{just go through it ,what I have done for each }$
$\text{employee the inner subquery will run inner query returns null }$
$\text{means that particular employee is working on all the project that are controlled}$
$\text{by department no. 5 and the query will return some value only when that particular employee}$


$\text{is not working on all projects controlled by dept. 5 }$

1
As, i have shown that employee b
Will not be selected as it is not working on all the projects that are controlled by dept. 5 but in first query ,
 IN is there  which compares a
value ssn with a set (or multiset) of values essn and evaluates to TRUE if ssn is one of the elements in essn as when inner most query project return {10,25,15} then due to IN the essn 2 of employee name b will also be considered as it is working on project 10 and 15 as result of which the ssn will be match with essn 2 and the row with employee name b get printed

Related questions

0 votes
1 answer
1
381 views
According to me it should be – “Retrieve the names of all students with a lower rank, than all students with age < 18 ”
asked Dec 24, 2018 in Databases Shubhanshu 381 views
0 votes
0 answers
2
161 views
Suppose there are two tuples in Animals relation with different IDs but of same type and in Adoption table there is a tuple with an ID that matches with the ID of first tuple in Animal relation. AND during the query evaluation, the type of first tuple of the animal relation ... same type are also present in Adoption table . but the thing is given answer is also wrong here. Correct me if i'm wrong.
asked Dec 20, 2018 in Databases Ashwani Yadav 161 views
0 votes
0 answers
3
204 views
a) 0 b) 1 c) 2 d) 3
asked Sep 15, 2018 in Databases Nirmal Gaur 204 views
1 vote
1 answer
4
257 views
Consider relational schema $R(A,B,C)$ and $S(A,B,C)$ $1)$ Select * from $R$ where $(A,B,C)$ in (Select * from $S$) $2)$ Select * from $R$ where exists ( Select * from $S$ where R.A=S.A and R.B=S.B and R.C=S.C) $3)$ Select * from R where $(A,B,C)$ not in((Select * from $R$ where $(A,B,C)$ not in)Select * from S) Which of the following SQL expression equal to $R\cap S$?
asked Jun 5, 2018 in Databases srestha 257 views
...