Primary Keys for Relationship Sets
The attributes of a relationship set are the attributes that comprise the primary keys of the entity sets involved in the relationship set.
- S.I.N. is the primary key of customer, and
- account-number is the primary key of account.
- The attributes of the relationship set custacct are then (account-number, S.I.N.).
This is enough information to enable us to relate an account to a person.
If the relationship has descriptive attributes, those are also included in its attribute set. For example, we might add the attribute date to the above relationship set, signifying the date of last access to an account by a particular customer.
Note that this attribute cannot instead be placed in either entity set as it relates to both a customer and an account, and the relationship is many-to-many.
The primary key of a relationship set depends on the mapping cardinality and the presence of descriptive attributes.
With no descriptive attributes:
- many-to-many: all attributes in .
- one-to-many: primary key for the “many” entity.
Descriptive attributes may be added, depending on the mapping cardinality and the semantics involved