Relationship Sets (Cont.) An attribute can also be associated with a relationship set. For instance,the advisor relationship set between entity sets instructor and student may have the attribute date which tracks when the student started being associated with the advisor 76766 Crick 98988 Tanaka 45565 Katz 3May2008 12345 Shankar 10June2007 10101 Srinivasan 00128 12June2006 Zhang 98345Kim 6une2009 76543 Brown 76543 Singh 30june2007 76653 Aoi 31May2007 22222 Einstein 23121 Chavez 4May2006 instructor 44553 Peltier student Database System Concepts 7.12 @Silberschatz,Korth and Sudarshan
Database System Concepts 7.12 ©Silberschatz, Korth and Sudarshan Relationship Sets (Cont.) An attribute can also be associated with a relationship set. For instance, the advisor relationship set between entity sets instructor and student may have the attribute date which tracks when the student started being associated with the advisor
Degree of a Relationship Set binary relationship involve two entity sets (or degree two). most relationship sets in a database system are binary. Relationships between more than two entity sets are rare.Most relationships are binary.(More on this later. Example:students work on research projects under the guidance of an instructor. relationship proj_guide is a ternary relationship between instructor,student,and project Database System Concepts 7.13 @Silberschatz,Korth and Sudarshan
Database System Concepts 7.13 ©Silberschatz, Korth and Sudarshan Degree of a Relationship Set binary relationship involve two entity sets (or degree two). most relationship sets in a database system are binary. Relationships between more than two entity sets are rare. Most relationships are binary. (More on this later.) Example: students work on research projects under the guidance of an instructor. relationship proj_guide is a ternary relationship between instructor, student, and project
Mapping Cardinality Constraints Express the number of entities to which another entity can be associated via a relationship set. Most useful in describing binary relationship sets. For a binary relationship set the mapping cardinality must be one of the following types: One to one One to many Many to one Many to many Database System Concepts 7.14 @Silberschatz,Korth and Sudarshan
Database System Concepts 7.14 ©Silberschatz, Korth and Sudarshan Mapping Cardinality Constraints Express the number of entities to which another entity can be associated via a relationship set. Most useful in describing binary relationship sets. For a binary relationship set the mapping cardinality must be one of the following types: One to one One to many Many to one Many to many
Mapping Cardinalities A B A B 0 01 01 b2 02 b2 0 03 03 03 0 bs (a) (b) One to one One to many Note:Some elements in A and B may not be mapped to any elements in the other set Database System Concepts 7.15 @Silberschatz,Korth and Sudarshan
Database System Concepts 7.15 ©Silberschatz, Korth and Sudarshan Mapping Cardinalities One to one One to many Note: Some elements in A and B may not be mapped to any elements in the other set
Mapping Cardinalities A B A B a 02 03 03 4 09 04 05 (a) (b) Many to Many to many one Note:Some elements in A and B may not be mapped to any elements in the other set Database System Concepts 7.16 @Silberschatz,Korth and Sudarshan
Database System Concepts 7.16 ©Silberschatz, Korth and Sudarshan Mapping Cardinalities Many to one Many to many Note: Some elements in A and B may not be mapped to any elements in the other set