Home » Database » Database miscellaneous » Question

Database miscellaneous

Direction: Consider the following relations A, B and C :

  1. How many tuples does the result of the following SQL query contain?
    SELECT A. Id
    FROM A
    WHERE A. Age > ALL (SELECT B. Age
    FROM B
    WHERE B. Name = ‘Arun’)
    1. 4
    2. 3
    3. 0
    4. 1
Correct Option: B

The meaning of "ALL" is the A. Age should be greater than all the values returned by the sub-query. There is no entry with name "arun" in table B. So the subquery will return NULL. If a sub-query returns an empty table or NULL, then the condition becomes true. Therefore, all the three row id's of A will be selected from table A.



Your comments will be displayed only after manual approval.