Discussion Forum
Que. | Table A Id Name Age ---------------- 12 Arun 60 15 Shreya 24 99 Rohit 11 Table B Id Name Age ---------------- 15 Shreya 24 25 Hari 40 98 Rohit 20 99 Rohit 11 Table C Id Phone Area ----------------- 10 2200 02 99 2100 01 Consider the above tables A, B and C. How many tuples does the result of the following SQL query contains? SELECT A.id FROM A WHERE A.age > ALL (SELECT B.age FROM B WHERE B. name = "arun") |
a. | 4 |
b. | 3 |
c. | 0 |
d. | 1 |
Answer:3 |
Swati :(September 23, 2020)
But relation B does not contains name = Arun..
|
But B realation does not contain name varun |
i think answer is incorrect because there is no tuple in table b name ARUN |
id also not contain 3 |
I think the answer should be 0 as the result of the subquery would be null and so comparing any age to null would be unknown, thus no output will be there |
I think the answer should be 0 |
Answer is 0. |
yes ans must be 0 |
Click Here to Reply |
Deepanshu sharma :(April 10, 2022)
Explanation: The meaning of “ALL” is the A.Age should be greater than all the values returned by the subquery. There is no entry with name “arun” in table B. So the subquery will return NULL. If a subquery returns NULL, then the condition becomes true for all rows of A (See this for details). So all rows of table A are selected.
|
Click Here to Reply |