Basic Concepts(Cont) Relationship sets A relationship is an association among several entities Example: Hayes depositor A-102 customer entity relationship set account entity A relationship set is a mathematical relation among n2 2 entities, each taken from entity sets {(e1e2,……en)le1∈E n Eny where (e1, e2, ., en)is a relationship Example: (Hayes, A-102)E depositor 标 Database System Concepts 2.6 @Silberschatz, Korth and Sudarshan
Database System Concepts 2.6 ©Silberschatz, Korth and Sudarshan Basic Concepts (Cont.) Relationship Sets A relationship is an association among several entities Example: Hayes depositor A-102 customer entity relationship set account entity A relationship set is a mathematical relation among n 2 entities, each taken from entity sets {(e1 , e2 , … en ) | e1 E1 , e2 E2 , …, en En } where (e1 , e2 , …, en ) is a relationship Example: (Hayes, A-102) depositor
Relationship Set borrower 321-12-3123 Jones MainHarrison L-171000 019-28-3746 Smith North Rye L232000 677-89-9011 HayesMainHarrison L-151500 555-55-5555 Jackson Dupont Woodside -141500 24466-8800Cury North Rve L-19|500 963-96-3963 Williams Nassau Princeton L-11|900 335-57-7991 Adams Spring Pittsfield L-16|1300 customer loan Database System Concepts 2.7 OSilberschatz. Korth and Sudarshan
Database System Concepts 2.7 ©Silberschatz, Korth and Sudarshan Relationship Set borrower
Basic Concepts(Cont An attribute can also be property of a relationship set For instance, the depositor relationship set between entity sets customer and account may have the attribute access-date depositor(access-date) account(account-number) customer(customer-name) 24May1996 3 June 1996 A-101 Johnson 21June1996 A-215 Smith 10June1996 A-102 H aves A305 Turner 17June1996 28May1996 A-201 Jones 28May1996 A-222 Lindsay 24June1996 A-217 23May1996 Database System nd Sudarshan
Database System Concepts 2.8 ©Silberschatz, Korth and Sudarshan Basic Concepts(Cont.) An attribute can also be property of a relationship set. For instance, the depositor relationship set between entity sets customer and account may have the attribute access-date
Basic Concepts(Cont Begree of a Relationship Set Refers to number of entity sets that participate in a relationship set Relationship sets that involve two entity sets are binary (or degree two). Generally, most relationship sets in a database system are binary Relationship sets may involve more than two entity sets E.g. Suppose employees of a bank may have jobs (responsibilities) at multiple branches, with different jobs at different branches. Then there is a ternary relationship set between entity sets employee, /gb and branch Relationships between more than two entity sets are rare. Most relationships are binary. (More on this later 5 Database System Concepts 2.9 OSilberschatz. Korth and Sudarshan
Database System Concepts 2.9 ©Silberschatz, Korth and Sudarshan Basic Concepts(Cont.) Degree of a Relationship Set Refers to number of entity sets that participate in a relationship set. Relationship sets that involve two entity sets are binary (or degree two). Generally, most relationship sets in a database system are binary. Relationship sets may involve more than two entity sets. Relationships between more than two entity sets are rare. Most relationships are binary. (More on this later.) E.g. Suppose employees of a bank may have jobs (responsibilities) at multiple branches, with different jobs at different branches. Then there is a ternary relationship set between entity sets employee, job and branch
Constraints Mapping Cardinalities 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 2.10 OSilberschatz. Korth and Sudarshan
Database System Concepts 2.10 ©Silberschatz, Korth and Sudarshan Constraints Mapping Cardinalities 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