GATE IT 2007 · SQL Queries

MCQ · 1 mark · Problem DBMS-SQL-0121

Consider the following relation schemas :b-Schema = (b-name, b-city, assets)a-Schema = (a-num, b-name, bal)d-Schema = (c-name, a-number)Let branch, account and depositor be respectively instances of the above schemas. Assume that account and depositor relations are much bigger than the branch relation.Consider the following query:\(\Pi _{c-name}(\sigma _{b-city="Agra" \wedge bal \lt 0} (branch \Join (account \Join depositor)))\)Which one of the following queries is the most efficient version of the above query ?
  1. A
    \(\Pi _{c-name} (\sigma_{bal \lt 0} (\sigma_{b-city="Agra"} branch \Join account) \Join depositor)\)
  2. B
    \(\Pi _{c-name} (\sigma_{b-city="Agra"} branch \Join (\sigma_{bal \lt 0} account \Join depositor)\)
  3. C
    \(\Pi _{c-name} ((\sigma_{b-city="Agra"} branch \Join \sigma_{b-city="Agra" \wedge bal \lt 0} account) \Join depositor)\)
  4. D
    \(\Pi _{c-name} (\sigma_{b-city="Agra"} branch \Join( \sigma_{b-city="Agra" \wedge bal \lt 0} account \Join depositor))\)

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

Show the worked solutionOfficial GATE Answer Key: Option A.See full step-by-step discussion on GateOverflow: https://gateoverflow.in/3513/gate2007-it-68

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