in Databases edited by
18,133 views
36 votes
36 votes

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

  1. $2$
  2. $3$
  3. $4$
  4. $5$
in Databases edited by
18.1k views

4 Comments

@Ani_  Yeah Geeks for geeks explanation is also good

 

0
0
Can someone explain why we can't combine (E1,R1) into one table ?
0
0

@_Bash_

Coz we might have repeating values in E$_{1}$.

0
0

4 Answers

51 votes
51 votes
Best answer

We need a separate table for many-to-many relation.
one-to-many relation doesn't need a separate table and can be handled using a foreign key.
So, answer is $B$ - $3$ tables.

Reference: MIT notes.

edited by
by

4 Comments

@sushmita

I am quite confused. We need to check normalization first and then decide the minimum no. of tables. But, then how we get the minimum no. tables for each normalization? I mean how we will decide whether we allowed Multi valued attribute or not, etc. 

Any source? 

0
0
@arjun sir the link shows “Page not found”.
0
0

@arjun

according to this source there should be 3 tables (E1, R1, E2) and the 4th table would be R2. Reasoning for having 3 separate tables for 1:m relation below:

https://www.cs.uct.ac.za/mit_notes/database/htmls/chp06.html#optional-for-both-entities

               1      R1     m

E1                                            E2

               m      R2     n

Please imagine the lines and boxes above

In 1:m relation, because it hasn’t been specified if participation of E2 in R1 is total, we have to ideally assume it to be optional.

And because it is optional, the foreign key of some tuples (if E1 and R2 is combined) will remain null. (check it out with making an example where relation is 1:m and participation is optional).

And generally, we don’t want null values in our tables, therefore we should make 3 tables E1, R1 and E2 instead of just 2 by merging R1 and E2 (sorry for not providing any standard text supporting this null value argument, but if you google you will surely find, and also i remember hearing this in the nptel lecture series of dbms of iit kharagpur Prof. Partha Pratim Chakrabarti)

 

0
0
14 votes
14 votes

Minimum no. of table required:

Relationship Type                 Participation # of Tables
1-1 Both Side Partial 2
1-1 1: Partial  1: Full 1
1-m Both Side Partial 2
1-m 1: Full       m: Partial 1
1-m 1: Partial  m: Full 2
m-m Both Side Partial 3
m-m m: Partial m: Full 2
m-m Both Side Full 1

m-1 relationship behave like 1-m . 

 

This question belongs to the 2 categories:


R1 :- it's 1-m(Both side Partial) relationship which need 2 tables 1 table foe E1 and other for E2(combine with R1 ) 

R2:- it's m-m(Both side Partial) relationship which need 3 tables 1 table for E1 , 1 table for R2 & 1 table for E2 . but E1 and E2 is already counted so, only remaining R2 is required .

Min. no. of table :- E1,E2,R2 = 3

1 comment

I think, You posted wrong in one row , many to many where one is partial needs 3 table not 2. Second row from bottom. @Arjun please check sir

0
0
9 votes
9 votes

Answer is 3 tables

2 Comments

3 Table are

1. E1

2.E2

3..R2
0
0

@VIDYADHAR SHELKE 1

Let E1 has attributes (a , b)  and E2 has (c , d)

So tables will be, for relationship R1 i.e. 1 to m. T1(a , b) and T2(c , d , a).

For relationship R2 i.e. m to n.

We need one extra  table T3(a , c).

So total 3 table required.

3
3
–3 votes
–3 votes

Answer (c)
The situation given can be expressed with following sample data.

E1
a
b
c

E2
x
y
z

R1
E1  E2
a    x
a    y
b    z


R2
E1   E2
a     x
a     y 
b     y 
Answer:

Related questions