Module 06b - Creating Relationships Flashcards
1:1 Strong Entity Relationships
Place the primary key of one entity in the other entity as a foreign key.
–> Either design will work—no parent, no child
–> Minimum cardinality considerations may be important.
- > O-M will require a different design than M-O.
- > One design will be very preferable.
1:N Strong Entity Relationships
–> Place the primary key of the table on the one side of the relationship into the table on the many side of the relationship as the foreign key.
–> The one side is the parent table and the many side is the child table, so “place the key of the parent in the child.”
N:M Strong Entity Relationships
The solution is to create an intersection table that stores data about the corresponding rows from each entity.
The intersection table consists only of the primary keys of each table which form a composite primary key.
Each table’s primary key becomes a foreign key linking back to that table.
COMPANY_PART_INT (CompanyName, PartNumber)
Four Uses for ID-Dependents Entities
- Representing N:M relationships
- Representing association relationships
- Storing multivalued attributes
- Representing archetypes/instance relationships
Intersection table vs Association table: what’s the difference by our textbook
–> An intersection table Holds the relationships between two strong entities in an N:M relationship; Contains ONLY the primary keys of the two entities:
- As a composite primary key
- As foreign keys
–> An association table Has all the characteristics of an intersection table PLUS it has one or more columns of attributes specific to the associations of the other two entities
N:M Recursive Relationships
Summary
–> Representing relationships using foreign keys.
–> The one side is the parent table and the many side is the child table place the key of the parent in the child.
–> N:M relationships: adding an intersection table to create direct link.