CS424 PK, FK, FD Normalization
Primary and Foreign Keys
Primary and foreign keys are the most basic components on which relational theory is based. Primary keys enforce entity integrity by uniquely identifying entity instances.
CS424 PK, FK, FD Normalization
Define Primary Key Attributes
Attributes are data items that describe an entity. An attribute instance is a single value of an attribute for an instance of an entity. For example, Name and hire date are attributes of the entity EMPLOYEE. "Jane Hathaway" and "3 March 1989" are instances of the attributes name and hire date.
The primary key is an attribute or a set of attributes that uniquely identify a specific instance of an entity. Every entity in the data model must have a primary key whose values uniquely identify instances of the entity.
CS424 PK, FK, FD Normalization
Con’t
To qualify as a primary key for an entity, an attribute must have the following properties:
it must have a non-null value for each instance of the entity
the value must be unique for each instance of an entity
the values must not change or become null during the life of each entity instance
CS424 PK, FK, FD Normalization
cont
An example of an entity that could have several possible primary keys is Employee. Let's assume that for each employee in an organization there are three candidate keys: Employee ID, Social Security Number, and Name.
CS424 PK, FK, FD Normalization
Primary Key Migration
Dependent entities, entities that depend on the existence of another entity for their identification, inherit the entire primary key from the parent entity. Every entity within a generalization hierarchy inherits the primary key of the root generic entity.
CS424 PK, FK, FD Normalization
Define Key Attributes
Once the keys have been identified for the model, it is time to name and define the attributes that have been used as keys.
There is no standard method for representing primary keys in ER diagrams. For this document, the name of the primary key followed by the notation (PK) is written inside the entity box.
Entities with Key Attributes
CS424 PK, FK, FD Normalization
Summary
Primary and foreign keys are the most basic components on which relational theory is based. Each entity must have a attribute or attributes, the primary key, whose values uniquely identify each instance of the entity. Every child entity must have an attribute, the foreign key, that completes the association with the parent entity.
Материалы на данной страницы взяты из открытых источников либо размещены пользователем в соответствии с договором-офертой сайта. Вы можете сообщить о нарушении.