中文网站
  Advanced Search
Read the latest Blogs from IT professionals in the field. Read and write community created documents. Need IT help? Ask our staff. Connect with your peers. Check our Tech Shop for posters, books and software tools. Home

2.6 Database Systems: 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.
For example:

  • 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 R depends on the mapping cardinality and the presence of descriptive attributes.
With no descriptive attributes:

Figure 2.7:An E-Rdiagram

Figure 2.8:One-to-many from customer to account

  • many-to-many: all attributes in R.
  • one-to-many: primary key for the \many" entity.

Descriptive attributes may be added, depending on the mapping cardinality and the semantics involved (see text).

Database System Structure: