What is the relational algebra corresponding to given query?

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:

Пc-name (σb-city = "Agra" ⋀ bal < 0 (branch ⋈ (account ⋈ depositor)

Which one of the following queries is the most efficient version of the above query ?

  1. Пc-name (σbal < 0 (σb-city = "Agra" branch ⋈ account) ⋈ depositor)
  2. Пc-name (σb-city = "Agra" branch ⋈ (σbal < 0 account ⋈ depositor))
  3. Пc-name ((σb-city = "Agra" branch ⋈ σb-city = "Agra" ⋀  bal < 0 account) ⋈ depositor)
  4. Пc-name (σb-city = "Agra" branch ⋈ (σb-city = "Agra" ⋀  bal < 0 account ⋈ depositor))
2Comments
Aastha Awasthi @aasthaawasthi
14 Sep 2017 02:02 pm

Right answer is 1.

set2018 @setgate
14 Sep 2017 03:39 pm

why not b