Null value in the foreign keythis is because of the

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ng Binary Relationships One­to­Many–Primary key on the one side becomes a foreign key on the many side Many­to­Many–Create a new relation with the primary keys of the two entities as its primary key One­to­One–Primary key on the mandatory side becomes a foreign key on the optional side 19 Example of mapping a 1:M relationship a) Relationship between customers and orders Note the mandatory one b) Mapping the relationship Foreign key Again, no null value in the foreign key…this is because of the mandatory minimum cardinality 20 Example of mapping an M:N relationship a) Completes relationship (M:N) The Completes relationship will need to become a separate relation 21 Example of mapping an M:N relationship (cont.) b) Three resulting relations Composite primary key Foreign key Foreign key New intersection relation 22 Example of mapping a binary 1:1 relationship a) In_charge relationship (1:1) Often in 1:1 relationships, one direction is optional. 23 Example of mapping a binary 1:1 relationship (cont.) b) Resulting relations Foreign key goes in the relation on the optional side, Matching the primary key on the mandatory side 24 Mapping Associative Entities Identifier Not Assigned Default primary key for the association relation is composed of the primary keys of the two entities (as in M:N relationship) Identifier Assigned It is natural and familiar to end­users Default identifier may not be unique 25 Example of mapping an associative entity a) An associative entity 26 Example of mapping an associative entity (cont.) b) Three resulting relations Composite primary key formed from the two foreign keys 27 Example of mapping an associative entity with an identifier a) SHIPMENT associative entity 28 Example of mapping an associative entity with an identifier b) Three resulting relations Primary key differs from foreign keys 29 Mapping Unary Relationships One­to­Many–Recursive foreign key in the same relation Many­to­Many–Two relations: One for the entity type One for an associative relation in which the primary key has two attributes, both taken from the primary key of the entity 30 Mapping a unary 1:N relationship (a) EMPLOYEE...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online