retagged by
10,326 views
4 votes
4 votes

Let $E_1$ and $E_2$ be two entities in E-R diagram with simple single valued attributes. $R_1$ and $R_2$ are two relationships between $E_1$ and $E_2$ where $R_1$ is one-many and $R_2$ is many-many. $R_1$ and $R_2$ do not have any attribute of their own. How many minimum number of tables are required to represent this situation in the Relational Model?

  1. 4
  2. 3
  3. 2
  4. 1
retagged by

4 Answers

Best answer
14 votes
14 votes
You need three tables:

For R1: Since it is one : many, you need just the tables for E1 and E2. E2 will have a foreign key referencing E1. Thus multiple tuples in E2 will reference the same tuple in E1.

For R2: Since it is a many : many, you need the tables E1 and E2 as well as a 3rd table for the mappings as it can be shown in neither E1 nor E2. In the third table, say E3, there will be references to both E1 and E2.

So, in all you need three tables.

Refer here also:

http://www.databaseprimer.com/pages/table-relationships/
selected by
2 votes
2 votes

Many-to-many relationships require a third table, known as an associate or linking table, because relational systems can't directly accommodate the relationship.

1 votes
1 votes

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.

Answer:

Related questions