137 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

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..