GATE 2012 CS (CS1) – Question 61
A(Id,Name,Age)={(12,Arun,60),(15,Shreya,24),(99,Rohit,11)}; B(Id,Name,Age)={(15,Shreya,24),(25,Hari,40),(98,Rohit,20),(99,Rohit,11)}; C(Id,Phone,Area)={(10,2200,02),(99,2100,01)}. How many tuples are returned?
SELECT A.Id FROM A
WHERE A.Age > ALL (SELECT B.Age FROM B WHERE B.Name='Arun')Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (B) 3
Explanation
No B row has name Arun, so the subquery is empty. A comparison quantified with ALL over the empty set is vacuously true. Consequently all three A rows are returned, giving 3, B. Their ages do not change that empty-set result.
More Relational Model: Relational Algebra, Tuple Calculus, SQL questions
- GATE 2013 CS (CS1) Q45
- GATE 2011 CS (CS1) Q42
- GATE 2011 CS (CS1) Q56
- GATE 2010 CS (CS1) Q29
- GATE 2010 CS (CS1) Q53
- GATE 2015 CS (CS2) Q40
All Relational Model: Relational Algebra, Tuple Calculus, SQL questions →