First time here? Checkout the FAQ!
+1 vote

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 (3.5k points)   | 42 views

1 Answer

+2 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 (76.9k points)  
selected by

Top Users Sep 2017
  1. Habibkhan

    6960 Points

  2. Warrior

    2424 Points

  3. Arjun

    2358 Points

  4. rishu_darkshadow

    2136 Points

  5. A_i_$_h

    2004 Points

  6. nikunj

    1980 Points

  7. manu00x

    1750 Points

  8. makhdoom ghaya

    1750 Points

  9. Bikram

    1744 Points

  10. SiddharthMahapatra

    1718 Points

26,059 questions
33,665 answers
31,078 users