Chapter7Notes - Mapping ER/EER Diagrams to Relations...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Mapping ER/EER Diagrams to Relations Definitions Primary Key – A primary key is a field (or combination of fields, called a composite key), which uniquely identifies a row or entity. Candidate Key – a key, although not selected as a primary key, can also be used to uniquely identify a row or entity. Foreign Key - a field in one relation, which refers to a field in another. Foreign keys are used in relational schema to represent a relationship between two relations/entities. A foreign key in one relation refers to the primary key field of the related relation/entity. Examples of a Foreign Key Suppose we have two tables, Customer and Purchase. These entities are related by the Purchases relationship. If we were to show the relations (tables) that are created based on the above ER diagram, it would look like the schema shown below. In the example above, the PurchasingCustID field in the Purchase relation is the foreign key, and it refers to the primary key of the Customer relation. The foreign
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

Chapter7Notes - Mapping ER/EER Diagrams to Relations...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online