edited by
6,527 views
18 votes
18 votes

The number of tables required in SELF-REFERENTIAL relation when different mappings(1: M, M:1, 1:1, M: N) are used with different participation (Partial Participation at both sides, Total Participation at both sides and partial participation at one side).

(Tabular Format answer will be appreciated).

edited by

3 Answers

Best answer
41 votes
41 votes

Whenever they ask about minimum number of tables then why can’t me merge all into one ? And have answer = 1 always.

Well, there are some situations when we go for more tables, lets see one by one.

1:1 Cardinality

Now suppose this is relationship I am having in which a3 and c1 are not participating

If you try to merge all into single table then it will look like this-

Here you can notice one thing, Both the columns have null somewhere (bcoz its partial participation)

And that’s why you can not merge into one table, bcoz if we do so, We can not even assign a primary key to table.

(Note: Primary key can not have null in it.)

Now what if atleast one side has total participation in 1:1 ?

In this case atleast one column will not be having any Null entries and we can make that column (that is either primary key of E1 or E2) as primary key of whole table and we can merge all into one.

Now you can (you should) check for other combinations. I am writing directly –

1.Only Partial participations-

  • One-One:2 Tables, Merge Relation to any of the side.
  • Many-One or One-Many:2 Tables, Merge Relation to Many side.
  • Many-Many:3 tables (separate table for relation)

2. Any one of the  side has full participation-

  • Full participation on Many Side: 2 Tables
  • Full Participation on one side: 1 Table

3.Both Side full participation-

  • Always one table irrespective of Cardinality.
selected by
14 votes
14 votes
PARTICIPATION 1:M M:1 1:1 M:N
Partial Participation on both side

2(min)

3(max)

2(min)

3(max)

2(min)

3(max)

3

Total participation on both side

2(min)

3(max)

2(min)

3(max)

2(min)

3(max)

1
Partial participation on one side

2(min)

3(max)

2(min)

3(max)

2(min)

3(max)

3

Min is what people usually used to avoid adding unnecessary tables, Max also we can provide by taking the primary key of the table of each side and create one new table.

For 1:1 in total participation at both side is 1 coz, whenever there is total participation with one to one cardinality, then the no. Of entities at both side will be equal. Therefore we can combine both the tables in one table which will save space

edited by
1 votes
1 votes
For 1:1 relationship:

1 table is required in each case.i.e total participation, partial participation.etc.

 

For N:M relationship:

2 table is required in each case.

 

For 1:M relationship:

1 table is sufficient.

Related questions

1 votes
1 votes
1 answer
1
aditi19 asked Jun 7, 2019
1,885 views
How to represent referential integrity constraint in ER model?pls explain with diagram
0 votes
0 votes
2 answers
2
kd..... asked Apr 26, 2019
814 views
Here if check_txn contains its own attributes then during converting into a relational model where does its attributes will be placed either in account side ( strong enti...