Database Example

Q.  Consider an SQL query

SELECT A.Id FROM A WHERE A.Age>
All (SELECT B.Age FROM B WHERE B.name = ‘Anay’)

The result of this query contains

- Published on 25 Aug 15

a. 1 tuple
b. 2 tuples
c. 3 tuples
d. 4 tuples

ANSWER: 3 tuples
 

    Discussion

  • Nirja Shah   -Posted on 05 Nov 15
    - The meaning of “ALL” is A.Age which should be greater than all the values returned by the subquery.

    - The subquery will return NULL as there is no entry with name “arun” in table B.

    - The condition becomes true for all rows of A if a subquery returns NULL.

    - So all rows of table A are selected.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)