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

© 4

(D) 5

# Please give answer with example

**prateek111**#1

**Rahul_Shah**#2

Three, first table E1,

2nd table E2,which holds the relationship R1

3rd table which holds the relationship R2

**satish**#3

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.

**Harsha_1997**#4

simple and shortcut solution for the problem is:

One table for each entity: 2

R1 is one-to-many(No separate Table): 0

R2 is many-many and requires one separate table: 1

Total No of tables: 3