Open In App

GATE | GATE-CS-2005 | Question 90

Like Article
Like
Save
Share
Report

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 separate table by having primary keys of E1 and E2 as foreign keys. One-to-many relationship (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 separate 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
Please comment below if you find anything wrong in the above post


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads