The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+3 votes

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 Loyal (7.6k points) | 137 views

1 Answer

+6 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 (98.7k points)
selected by

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

36,194 questions
43,647 answers
42,928 users