The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+2 votes
106 views

1)retrieve all name of all employees whose salary is more than minimum salary

2)retrieve all name of all employees from all departments

3)retrieve all name of all employees from all who are working in works

d) retrieve zero rows

asked in Databases by Boss (6.6k points) | 106 views

1 Answer

+4 votes
Best answer

Here the key line to watch for is :

If "dept"  table contains  0   rows

then in that case the statement :  "from  dept D , works W" which does the cartesian product of D and W will return 0 rows and hence the result of inner query of ALL() will be empty..And we know :

X  operation  ALL() returns true if  the result of the ALL() is empty..

Hence the condition :   E.salary >  ALL ( the given inner query in the question ) will return true always..

Hence all employee records will be selected regardless of departments..Consequently names of all employees in all departments will be displayed..Alternatively we could have also used NOT IN to achieve the same result..

Hence B) should be the correct answer..Had the clause been "ANY" or "IN"  instead of "ALL" or "NOT IN" in that case D) would have been the answer..

answered by Veteran (96.5k points)
selected by

Related questions

+1 vote
1 answer
1
asked ago in Databases by pa-try (113 points) | 31 views
+2 votes
1 answer
2


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

28,946 questions
36,791 answers
91,045 comments
34,687 users