recategorized
3,243 views
6 votes
6 votes

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$
recategorized

5 Answers

Best answer
6 votes
6 votes

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.
selected by
8 votes
8 votes
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).
Answer:

Related questions

1 votes
1 votes
2 answers
1
go_editor asked Mar 24, 2020
1,173 views
An attribute $A$ of datatype varchar $(20)$ has value 'Ram' and the attribute $B$ of datatype char $(20)$ has value 'Sita' in oracle. The attribute $A$ has ________ memor...
0 votes
0 votes
3 answers
4