Consider the following relations A, B and C: How many tuples does the result…

2012

Consider the following relations A, B and C:

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’)

Answer: B. 3Key idea: evaluate the subquery and apply the ALL semantics. Evaluate the subquery: SELECT B.Age FROM B WHERE B.Name = 'Arun' → no rows (B contains no tuple…

  1. A.

    4

  2. B.

    3

  3. C.

    0

  4. D.

    1

Attempted by 266 students.

Show answer & explanation

Correct answer: B

Key idea: evaluate the subquery and apply the ALL semantics.

  • Evaluate the subquery: SELECT B.Age FROM B WHERE B.Name = 'Arun' → no rows (B contains no tuple with Name = 'Arun').

  • Apply the condition A.Age > ALL (empty set). A universal comparison over an empty set is vacuously true, so every A.Age satisfies the condition.

  • Therefore every tuple in A qualifies. The query returns A.Id for all three rows (12, 15, 99), so the result contains 3 tuples.

Explore the full course: Iocl Engineers Officers Grade A Paper 2

Loading lesson…