Foreign_Keys_rules - Primary Keys of the two entity types...

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

View Full Document Right Arrow Icon
Foreign Keys—Two Rules Purpose: To enable queries that link across two or more tables/entities Rule #1: For 1:N relationships Put the Primary Key attribute from the entity type on the 1 side as a Foreign Key attribute on the entity type on the N side. PK1 E1Attrib2 PK2 P K1 E2 Attrib2 (0,n) (1,1) Rule #2: For M:N relationships Create a new entity type between the two entity types involved. The Primary Key for the new entity type is a composite key comprised of the
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Primary Keys of the two entity types involved. Example result of applying the rule: PK1 E1Attrib2 PK1 PK2 PK2 E2 Attrib2 (0,n) (1,1) (1,1) (0,n) R1 R2 This composite Primary Key acts as a Foreign Key. Be sure to add new relationships, relationship labels, cardinality and optionality to the links from each original entity type to the linking entity type in the middle. E1 E2 R1 new E1 E2 E-New new...
View Full Document

Ask a homework question - tutors are online