• recategorized by
8,664 views
27 27 votes

​​​​​Consider a database that includes the following relations:

Defender(name, rating, side, goals)
Forward(name, rating, assists, goals)
Team(name, club, price)

Which ONE of the following relational algebra expressions checks that every name occurring in Team appears in either Defender or Forward, where $\phi$ denotes the empty set?

  1. $\Pi_{\text {name }}($ Team $) \backslash\left(\Pi_{\text {name }}(\right.$ Defender $) \cap \Pi_{\text {name }}($ Forward $\left.)\right)=\phi$
  2. $\left(\Pi_{\text {name }}(\right.$ Defender $) \cap \Pi_{\text {name }}($ Forward $\left.)\right) \backslash \Pi_{\text {name }}($ Team $)=\phi$
  3. $\Pi_{\text {name }}($ Team $) \backslash\left(\Pi_{\text {name }}(\right.$ Defender $) \cup \Pi_{\text {name }}($ Forward $\left.)\right)=\phi$
  4. $\left(\Pi_{\text {name }}(\right.$ Defender $) \cup \Pi_{\text {name }}($ Forward $\left.)\right) \backslash \Pi_{\text {name }}($ Team $)=\phi$

6 Answers

Best answer
21 21 votes

Analysis of options -

$A\setminus B$ is the set difference operator that return all tuples that are in set A but not in B.

If this equates to $\phi$ then we can say that all elements (tuples) of A are present in B.

 

Option A $\rightarrow$

$\Pi_{name}$(Team) projects names from the team table. - (i)

$\Pi_{name}$(Defender) $\cap$ $\Pi_{name}$(Forward) will gives us all the names that are both in Defender and Forward table. - (ii)

(i) $\setminus $ (ii) will give us only those names that are in the Team table and not in both Defender and Forward Table.

If this equates to $\phi$ then we can say that it checks that every name in Team table is also in Defender and Forward table.

 

Option B $\rightarrow$

This is doing same operation as Option A. Only difference is that it is doing (ii) $\setminus $ (i)

(ii) $\setminus $ (i) will give us only those names that are in the in both Defender and Forward Table but not in Team table

If this equates to $\phi$ then we can say that it checks that every name that is in both Defender and Forward table is also in Team table.

 

Option C $\rightarrow$

$\Pi_{name}$(Defender) $\cup$ $\Pi_{name}$(Forward) will gives us all the names that are either in Defender or Forward table. - (iii)

(i) $\setminus $ (iii) will give us only those names that are in Team table but not in either the Defender or Forward Table.

If this equates to $\phi$ then we can say that it checks that every name that is in Team table is also in either the Defender or Forward table.

 

Hence C is our required Answer.

We can do similar analysis on Option D to find out that it checks that all the names in either the Defender or Forward table are also in the Team table.

• selected by
9 9 votes

Detailed Video Solution, with Complete Analysis: https://www.youtube.com/watch?v=h3pJZbed9M8&t=596s 

Concept:

$R - S = \phi$ if and only if $R \subseteq S.$

Or

$R \subseteq S $ if and only if $ R - S = \phi$


Understanding from Cricket point of view:

Assume: Defender = Batsmen ; Forward = Bowler ; Team = Final-11 Indian Team

Option A: Every player in the Team is an Alrounder.

Option B: Every Alrounder is in the Team.

Option C: Every player in the Team is either a Batsman or a Bowler (or Both).

Option D: Every Batsman, Every Bowler is in the Team. 

So, our answer is Option C. 

2 2 votes

We have following three tables:

  • Defender(name, rating, side, goals)  --- We get all the defenders name
  • Forward(name, rating, assists, goals) --- We get all the forwards name
  • Team(name, club, price) -- we get all the players with respect to Team

every name occurring in Team appears in either Defender or Forward

We need to represent this statement in relational algebra expressions. 

So I need to pick each player from a team, then I need to verify that whether the name is in Defender table or Forward Table.

This is something like 

// i used for Team table, j used for Deferder table and k used for forwards table.
p,q,r are represents respective table sizes

for(i=0;i<p;i++)
{
    found_in_defender=0, found_in_forward=0;
    for(j=0;j<q;j++){
        if(T[i]==D[j]){
            found_in_defender=1;
            break;
        }
    }
    if(found_in_defender!=1){
        for(k=0;k<r;k++){
            if(T[i]==F[k]){
                found_in_forward=1;
                break;
            }
        }
       if(found_in_forward!=1)
        printf("Person neither found in Defender nor Forward tables");
    }

}

Please note that, player is not required to be in the both Defender or Forward tables. 

That is equivalent to: $[Team - (Defender \cup Forward)] = \phi$

 

Now, coming to the options, I don't know what is that operator used in the options.

But I noticed that, there is a intersection between Defender or Forward tables in two options i.e., option A and Option B.

As our requirement is either player should be in Defender or Forward but not player should be in Defender and Forward tables. Whatever may be the operator (consider standard operators like union, intersection, difference, division etc) that works on players who are in Defender and Forward, will not satisfy our requirements.

\( \therefore \text{Eliminate option A and option B} \Rightarrow \text{either option C or option D is the answer}\)

 

I noticed that, there is a union between Defender or Forward tables in both the options i.e., option C and Option D.

However, option D checking in reverse way. I mean, it is picking each player in the Defender table checking whether player is in the team table or not. Then picking each player in the Forward table checking whether player is in the team table or not. This ensure that whether every player from Defender or Forward table is in the team or not. But our requirement is every person listed in Team appears in either Defender or Forward tables or not. Hence, Option D is not correct choice.

 

Coming to Option C, the operator look like set difference and it will satisfy our requirements

\( \therefore \text{option C is the correct answer} \)

• edited by
1 1 vote
division has a simple logic that if we divide A/B having attribute set x and y such that y⊂x then all tuples of A will be in result which has relation with all of B with attribute y here in c as if we think defender ad forward combine makes more records then in team so players in team (either defender of forward) will be ⊂ (defender ∪ forward) and hence team / defender ∪ forward will expect results where all records of defender ∪ forward related to any record in team which is not possible as team ⊂ (defender ∪ forward) so will give null result

hence C

pls correct if anything wrong
1 flag:
✌ Low quality (Anurag_Kesharwani)
0 0 votes
D
1 flag:
✌ Edit necessary (Sri28 “wrong answer”)
Answer:
Position:
Show:

Related questions

19 19 votes
5 5 answers
6.2k
6.2k views
Arjun asked Feb 16, 2024
6,230 views
Consider the following two tables named Raider and Team in a relational database maintained by a Kabaddi league. The attribute ID in table Team references the primary key...
22 22 votes
3 3 answers
6.0k
6.0k views
Arjun asked Feb 16, 2024
5,987 views
​​​​​​Given the relational schema $R=(U, V, W, X, Y, Z)$ and the set of functional dependencies:\[\{U \rightarrow V, U \rightarrow W, W X \rightarrow Y, W X \rightarrow Z...
21 21 votes
5 answers 5 answers
6.6k
6.6k views
Arjun asked Feb 16, 2024
6,642 views
​​​​​​An OTT company is maintaining a large disk-based relational database of different movies with the following schema:\[\begin{array}{l}\text { Movie (ID, CustomerRati...
13 13 votes
3 3 answers
11.3k
11.3k views
Arjun asked Feb 16, 2024
11,287 views
​​​​​If ' $\rightarrow$ ' denotes increasing order of intensity, then the meaning of the words [sick $\rightarrow$ infirm $\rightarrow$ moribund] is analogous to [silly $...