Thursday, October 15, 2015

Conversion to Relational Model (Part 6)



Conversion to Relational Model

One-one-one relationship

a)




Converting the above ER diagram to a relational model:

A:                 B:                 C:                                  D:

a                   b                    c                          a | b | c
                                                                           

For the relationship D to be modeled as a relation, primary keys a, b, c from entities A, B and C respectively go to D as foreign keys which in turn are reset altogether as a primary key for the relation.


b) Alternative relational model for one-one-one relationship
 

Converting the above ER diagram to a relational model:

A:                 B:                 C:                                  D:

a                   b                    c                             did | a | b | c


Alternatively, if the relationship D has already a primary key did, it can be modeled as a relation by taking primary keys a, b, c from entities A, B and C respectively as foreign keys.

 Note: As with many-many binary relationship, with ternary relationships, the primary key of the relation modeled from the relationship needs to be determined after careful inspection.



 




 

          

Thursday, October 8, 2015

Conversion to Relational Model Part 5



Conversion to Relational Model 
(Many-many-many ternary relationship)

                                 Fig: Many-many-many Ternary ERD
 

The above ER diagram is transformed to the following relational model:

Patient:
pNr | pName  

Doctor:
dNr | dName | salary

MonthlyReport:                             
rNr | date | author

admin:
dNr | pNr | rNr