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.