GATE | GATE-CS-2005 | Question 90



Let E1 and E2 be two entities in an E/R diagram with simple single-valued attributes. R1 and R2 are two relationships between E1 and E2, where R1 is one-to-many and R2 is many-to-many. R1 and R2 do not have any attributes of their own. What is the minimum number of tables required to represent this situation in the relational model?
(A) 2
(B) 3
(C) 4
(D) 5


Answer: (B)

Explanation: The answer is B, i.e minimum 3 tables.

Strong entities E1 and E2 are represented as separate tables.

In addition to that many-to-many relationships(R2) must be converted as seperate table by having primary keys of E1 and E2 as foreign keys.

One-to-many relaionship (R1) must be transferred to ‘many’ side table(i.e. E2) by having primary key of one side(E1) as foreign key( this way we need not to make a seperate table for R1).

Let relation schema be E1(a1,a2) and E2( b1,b2).



Relation E1( a1 is the key)

a1 a2
-------
1 3
2 4
3 4

Relation E2( b1 is the key, a1 is the foreign key, hence R1(one-many) relationship set satisfy here )

b1 b2 a1
-----------
7 4 2
8 7 2
9 7 3

Relation R2 ( {a1, b1} combined is the key here , representing many-many relationship R2 )

a1 b1
--------
1 7
1 8
2 9
3 9

Hence we will have minimum of 3 tables.


Quiz of this Question



My Personal Notes arrow_drop_up

Recommended Posts:



0 Average Difficulty : 0/5.0
No votes yet.






User Actions