UGC-NET Sep 2013 · SQL Queries

MCQ · 2 marks · Problem DBMS-SQL-0023

The SQL expressionSelect distinct T.branch_name from branch T, branch S where T.assets>S.assets and S.branch_city = “Mumbai” finds the names of
  1. A
    All branches that have greater assets than some branch located in Mumbai
  2. B
    All branches that have greater assets than all branches in Mumbai
  3. C
    The branch that has greatest asset in Mumbai
  4. D
    Any branch that has greater assets than any branch in Mumbai

Solve it on GATE DA practice →More Relational Model & SQL problems

Show the worked solutionThe query compares each branch T with each Mumbai branch S and keeps T if T.assets \(>\) S.assets for at least one such pair. So the condition is "greater than some Mumbai branch" (an existential test, equivalent to \(>\) SOME).(B) "All Mumbai branches" would need \(>\) ALL or NOT EXISTS — incorrect.(C) T is not restricted to Mumbai, and no maximum is taken — incorrect.(D) "Any" is ambiguous; the precise meaning is "some" — (A) states it.Answer: A

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com