The primary key of a relationship set in an E-R data model

In summary, the conversation discusses a potential contradiction in a book about database systems. It is clarified that the composition of the primary key for a relationship set does not depend on the set of attributes associated with the relationship set. An example is provided to illustrate this concept and it is mentioned that transforming the relationship set into an entity set is not a common practice.
  • #1
Eus
94
0
Hi Ho!

I have posted this same question about three weeks ago on MySQL forum (http://forums.mysql.com/read.php?125,197805,197805) and on the mailing list of the book itself about two weeks ago (db-book-list@cs.yale.edu). But, still there is no response at all. Therefore, I try my luck by posting the question here.

On a book, which is published by McGraw Hill, titled Database System Concepts, 4th Edition, by Silberschatz, Korth, and Sudarshan, I found a contradiction that I would like to clarify with you.

The problem is within chapter 2, which starts on page 27 and ends on page 77, that discusses Entity-Relationship Model.
On page 36 in a section that discusses the key to distinguish among the various relationships of a relationship set, there is the following statement:

Let R be a relationship set involving entity sets [itex]E_{1},\ E_{2},\ ...,\ E_{n}[/itex].
Let [itex]primary-key(E_{i})[/itex] denote the set of attributes that forms the primary key for entity set [itex]E_{i}[/itex].
Assume for now that the attribute names of all primary keys are unique, and each entity set participates only once in the relationship.
The composition of the primary key for a relationship set depends on the set of attributes associated with the relationship set [itex]R[/itex].

In my opinion, the last sentence is wrong. The right one should be as follows:

"The composition of the primary key for a relationship set does not depend on the set of attributes associated with the relationship set [itex]R[/itex]."

The following evidences support my argument:
1. On page 32 in a section that discusses Relationship Sets there is the following statement:

"A relationship instance in a given relationship set must be uniquely identifiable from its participating entities, without using the descriptive attributes."

Previously, the descriptive attributes are defined as attributes that are associated with a relationship set.
With other words, the composition of the primary key for a relationship set does not depend on the set of attributes associated with the relationship set R.

2. On page 36 just below the concerned statement, it is written that:

If the relationship set R has no attributes associated with it, then the set of attributes
[tex]
primary-key(E_{1})\ \bigcup\ primary-key(E_{2})\ \bigcup\ ...\ \bigcup\ primary-key(E_{n})
[/tex]
describes an individual relationship in set [itex]R[/itex].

If the relationship set [itex]R[/itex] has attributes [itex]a_{1},\ a_{2},\ ...,\ a_{m}[/itex] associated with it, then the set of attributes
[tex]
primary-key(E_{1})\ \bigcup\ primary-key(E_{2})\ \bigcup\ ...\ \bigcup\ primary-key(E_{n})\ \bigcup\ \left \{a_{1},\ a_{2},\ ...,\ a_{2}\right \}
[/tex]
describes an individual relationship in set [itex]R[/itex].

In both of the above cases, the set of attributes
[tex]
primary-key(E_{1})\ \bigcup\ primary-key(E_{2})\ \bigcup\ ...\ \bigcup\ primary-key(E_{n})
[/tex]
forms a superkey for the relationship set.

Because in both of the above cases the superkey (i.e., a set of one or more attributes that, taken collectively, allow us to identify uniquely a relation in a relationship set) is just
[tex]
primary-key(E_{1})\ \bigcup\ primary-key(E_{2})\ \bigcup\ ...\ \bigcup\ primary-key(E_{n})
[/tex],
the composition of the primary key for a relationship set does not depend on [itex]{a_{1},\ a_{2},\ ...,\ a_{m}}[/itex] (i.e., the set of attributes associated with the relationship set [itex]R[/itex]).
With other words, in both of the above cases, the set of attributes
[tex]
primary-key(E_{1})\ \bigcup\ primary-key(E_{2})\ \bigcup\ ...\ \bigcup\ primary-key(E_{n})
[/tex]
is sufficient to describes an individual relationship in set [itex]R[/itex].
Therefore, the composition of the primary key for a relationship set does not depend on the set of attributes associated with the relationship set [itex]R[/itex].

To conclude, is it true that the composition of the primary key for a relationship set does not depend on the set of attributes associated with the relationship set [itex]R[/itex]?

In practice there are some examples that require the use of descriptive attributes to form the primary key of a relationship set. One such examples is as follows:

Consider two entity sets: Student and Course along with one relationship set: Took that describes a many-to-many relationship between Student and Course, as well as one descriptive attribute associated with the relationship set: Quarter.

If one student is only permitted to take a course once, then the primary key of the relationship set will be
[tex]
primary-key(Student)\ \bigcup\ primary-key(Course)
[/tex]

But, if one student is permitted to take a course more than once, then the primary key of the relationship set will be
[tex]
primary-key(Student)\ \bigcup\ primary-key(Course)\ \bigcup\ {Quarter}
[/tex]

If it is true that:
"The composition of the primary key for a relationship set does not depend on the set of attributes associated with the relationship set [itex]R[/itex].",
the relationship set of the aforementioned example must be transformed to an entity set named: Academic Quarter in spite of the fact that we are still working on the E-R data model (usually we start creating bridging-tables and other necessary transformations when we translate the E-R data model into the relational data model).

Is such transformation a common practice when modeling data with E-R data model because the composition of the primary key for a relationship set does not depend on the set of attributes associated with the relationship set [itex]R[/itex]?

Thank you very much.


Eus
 
Technology news on Phys.org
  • #2
Hi Eus,

It is true that the composition of the primary key for a relationship set does not depend on the set of attributes associated with the relationship set R. This is because the primary key of the relationship set must be able to uniquely identify a relationship instance from its participating entities without using the descriptive attributes.

The example you have given is a good illustration of this concept. In this case, if one student is permitted to take a course more than once then the primary key must include the descriptive attribute Quarter in order to uniquely identify each instance of the relationship between the student and the course.

Transforming the relationship set into an entity set is not a common practice when modeling data with the E-R data model. It is more common to use a bridging table or other necessary transformations when translating the E-R data model into the relational data model.

I hope this helps!
 
  • #3



Hello Eus,

Thank you for bringing this contradiction to my attention. After reviewing the statements in the book, I agree with your argument that the composition of the primary key for a relationship set does not depend on the set of attributes associated with the relationship set R. This is consistent with the definition of a relationship set, which is simply a set of relationships between entities and does not include any descriptive attributes.

In practice, it is common to use descriptive attributes to form the primary key of a relationship set, as you have mentioned in your example. This is done in order to uniquely identify a specific instance of the relationship set. However, this is not a requirement and as you pointed out, the relationship set can be transformed into an entity set if necessary.

In conclusion, I believe your understanding of the concept is correct and I would recommend reaching out to the authors or editors of the book to clarify this contradiction. Thank you for bringing this to my attention and I hope this helps clarify your understanding of the primary key in an E-R data model.

Best,
 

1. What is the primary key in an E-R data model?

The primary key is an attribute or a combination of attributes that uniquely identifies each record in a table of a relational database. In an E-R data model, the primary key of a relationship set is the attribute that uniquely identifies each instance of the relationship.

2. How is the primary key determined in an E-R data model?

The primary key of a relationship set in an E-R data model is determined by identifying the minimum set of attributes that can uniquely identify each instance of the relationship. This can be either a single attribute or a combination of attributes.

3. Can a primary key be null in an E-R data model?

No, a primary key cannot be null in an E-R data model. This is because the primary key is used to uniquely identify each record in a table, and a null value would mean that the record cannot be identified.

4. Can a relationship set have more than one primary key in an E-R data model?

Yes, a relationship set can have more than one primary key in an E-R data model. This is known as a composite key, where the combination of attributes uniquely identifies each instance of the relationship.

5. Can the primary key of a relationship set change in an E-R data model?

No, the primary key of a relationship set should not change in an E-R data model. This is because the primary key is used to identify and link records between tables, and any changes to the primary key could result in data inconsistencies and errors.

Similar threads

  • Programming and Computer Science
Replies
3
Views
1K
  • Precalculus Mathematics Homework Help
Replies
6
Views
1K
  • Quantum Interpretations and Foundations
2
Replies
45
Views
3K
  • Set Theory, Logic, Probability, Statistics
Replies
20
Views
2K
  • Special and General Relativity
Replies
5
Views
945
  • Programming and Computer Science
Replies
1
Views
824
  • Engineering and Comp Sci Homework Help
Replies
4
Views
2K
Replies
1
Views
572
  • Beyond the Standard Models
Replies
19
Views
5K
Replies
2
Views
863
Back
Top