Identifying Attributes › Identifying the Attributes of Each Entity
Identifying the Attributes of Each Entity
Each entity in a database is described by certain attributes. Attributes are those pieces of information about an entity that are required for processing performed by the business functions. By carefully examining the business functions, you can determine which attributes need to be maintained for each entity in the database.
Attribute categories
Attributes for a data entity fall into the following categories:
- Unique keys—To distinguish data occurrences, you need to identify unique keys. A unique key is an attribute or combination of attributes whose value or values uniquely identify an occurrence of an entity or relationship. Identification numbers and codes are typically used as unique keys, since their values are rarely modified.
- Primary keys—A primary key is a unique key that is used to represent an entity in a database. For example, the attribute EMP ID might be used as the primary key of the entity EMPLOYEE.
- Secondary keys—A secondary key is an attribute in a data entity that is used by certain business functions to access occurrences of that entity. For example, the EMP NAME attribute might be the secondary key for the entity EMPLOYEE.
- Foreign keys—A foreign key is an attribute of an entity or relationship that is also used as the primary key of another entity. A foreign key is used to relate two data entities. For example, to relate the DEPARTMENT and EMPLOYEE entities, you might define the DEPT ID attribute, which is the primary key of the DEPARTMENT entity, as the foreign key of the EMPLOYEE entity.
By itself, a foreign key can never be the primary key of the entity in which it is stored. Since the DEPT ID attribute could never uniquely identify an occurrence of the EMPLOYEE entity, it could never be its primary key.
However, a foreign key can be part of the primary key of an entity. In some instances, you need to combine a foreign key with another data element in an entity to create its primary key.
- Non-key data—All attributes of an entity that are not unique keys, primary keys, secondary keys, or foreign keys are considered non-key attributes. For example, the EMP ADDRESS attribute is a non-key attribute of the EMPLOYEE entity.
As you identify the attributes of each data entity, you need to determine whether the attributes are unique keys, primary keys, secondary keys, foreign keys, or non-key attributes.
Copyright © 2014 CA.
All rights reserved.
|
|