1,696 views

Let $M$ and $N$ be two entities in an $E-R$ diagram with simple single value attributes. $R_{1}$ and $R_{2}$ are two relationship between $M$ and $N$, where as $R_{1}$, is one-to-many and $R_{2}$, is many-to-many.

The minimum number of tables required to represent $M, N, R_{1}$, and $R_{2}$, in the relational model are ___________.

1. $4$
2. $6$
3. $7$
4. $3$

### 1 comment

Total four table required.

M, (n,r1),n,(m,n,r2)

for R1 we don't need any table as we can put the relation on N side.

for R2 we need a separate table.

correct me if am wrong

Ans is option 4 i.e 3 relations

Two tables are created for entities M and N      and third table is created for relationships R2 (many to many)

for R1 no need of seperate table (one to many)

• 1-m relationships
The primary key from the one side' is placed as a foreign key in the many side'.
• m-n relationships
A new relation is created with the primary keys from each entity forming a composite key.
• 1-1 relationships
Depending on the optionality of the relationship, the entities are either combined or the primary key of one entity type is placed as a foreign key in the other relation.
There will be two separate table for the two entities M and N.There will be a separate table for R1 relationship where primary key will be the primary key of the relation N.But R1 is one to many from M to N.So the relationship can be merged to the many side entity that is N.So there will be a single table for the entity N and relationship R1.For another relation R2 which is many-to-many there will be a separate table.

So total number of tables will be 3.

(Important points:

For many-to-many relationships there will always be a separate table and that table can not be merged with another entity.Primary key will be the combination of the primary keys of the participating entities).

### 1 comment

Yeah option (D)3 is the right answer
Option 4-3 tables

M,NR1,R2
Minimum three tables will be required as table for M.NR1 & R2.

1 vote