When to use composite primary keys

7,148 views
6,493 views

Published on

Published in: Travel, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
7,148
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
26
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

When to use composite primary keys

  1. 1. By:Alyssa Marie T. Paral Mary May C. Porto
  2. 2. 2 Cases of the Composite Primary Keys As identifiers of composite entities, where each primary key combination is allowed once in the M:N relationship.As identifiers of weak entities, where the weak entity has a strong identifying relationship with the parent entity.
  3. 3. To illustrate the first case, assume that you have a STUDENT entity set and a CLASS entity set. In addition, assume that those two sets are related in an M:N relationship via an ENROLL entity set in which each student/class combination may appear only once in the composite entity. Shows the ERD to represent such a relationship.
  4. 4. The composite primary key automatically provides the benefit of ensuring that there cannot be duplicate values- that is, it ensures that the same student cannot enrol more than once in the same class.
  5. 5. A real-world object that is existence-dependent on another real-world object.Those types of objects are distinguishable in the real world.A dependent and an employee are two separate people who exist independently of each other.However, such objects can exist in the model only when they relate to each other in a strong identifying relationship.
  6. 6. A real-world object that is represented in the data model as two separate entities in a strong identifying relationship.In both situations, having a strong identifying relationship ensures that the dependent entity can exist only when it is related to the parent entity.
  7. 7. In summary, the selection of a composite primary key for composite and weak entity types provides benefits that enhance the integrity and consistency of the model.
  8. 8. Figure:5.6 The M:N relationshipbetween STUDENT and CLASS 

×