The SQL expression Select distinct T.branch_name from branch T, branch S where…
2013
The SQL expression
Select distinct T.branch_name
from branch T, branch S
where T.assets > S.assets and S.branch_city = "Mumbai"
finds the names of
- A.
All branches that have greater assets than some branch located in Mumbai.
- B.
All branches that have greater assets than all branches in Mumbai.
- C.
The branch that has greatest asset in Mumbai.
- D.
Any branch that has greater assets than any branch in Mumbai.
Attempted by 82 students.
Show answer & explanation
Correct answer: A
The query performs a self-join on the branch table. The condition S.branch_city = 'Mumbai' restricts the second instance (S) to branches in Mumbai. The condition T.assets > S.assets compares assets of the first instance (T) against those in Mumbai. This finds branches (T) that have assets greater than at least one branch located in Mumbai.
A video solution is available for this question — log in and enroll to watch it.