one to one relationship type:
- As shown above, the two entities experiencing a one to one relationship are merged into one table.
- One to one relationships are interesting cases because usually they are combined already in the ERD, however certain situation might require us to separate them.
- The table's name and keys can also be adusted.
- In this example, the person's ID and the heart's ID might point the same record, it might be mode efficient to use just one key and adjust the table name as well.
one to many relationship type:
- Tables by themselves cannot show a relationship unlike drawing a diamond in ERD's.
- Instead, tables use an extra attribute called the foreign key to link tables together.
many to many relationship:
Before converting, though make sure that the many to many relationship is already broken down with a composite entity.
- Each entity is converted into its own schema like before.
- However in many to many situations, we also convert the composite entity into is won schema.
There are no foreign keys involved but the composite entity's keys are indirectly linking the other two entities.
- The composite entity tables are usually very small in terms of the amount of attributes they have.
- A naming convention for these tables is to use the name from the other tow tables in the relational model.
Super and Sub Types:
- Super/sub types in relational models are interesting.
- Recall that sub types(child) automatically inherit attributes from the super(parent).
- There are two ways you can portray super/sub types in table form.
- Create a table for the super type then a table for each sub type. Only include unique attributes and relationships in the sub type tables.(recommended)
- Only create sub types and include all inherited attributes in each sub type table.
No comments:
Post a Comment