Constraints(c。nt) A B B (b) One to one One to many Note: Some elements in A and B may not be mapped to ar elements in the other set Database System Concepts 2.11 @Silberschatz, Korth and Sudarshan
Database System Concepts 2.11 ©Silberschatz, Korth and Sudarshan Constraints (Cont.) One to one One to many Note: Some elements in A and B may not be mapped to any elements in the other set
Constraints(c。nt) B B bai Many to one Many to many Note: Some elements in A and B may not be mapped to an elements in the other set Database System Concepts 2.12 @Silberschatz, Korth and Sudarshan
Database System Concepts 2.12 ©Silberschatz, Korth and Sudarshan Constraints (Cont.) Many to one Many to many Note: Some elements in A and B may not be mapped to any elements in the other set
Constraints(Cont Participation Constraints The participation of an entity set E in a relationship set R is said to be total if every entity in E participates in at least one relationship in R For example, we expect every loan entity to be related to at least one customer through the borrower relationship. If only some entities in E participate in relationship in R, the participation of entity set E in relationship R is said to be partial For example, the participation of customer in the borrower relationship set is therefore set is therefore partial Database System Concepts 2.13 @Silberschatz, Korth and Sudarshan
Database System Concepts 2.13 ©Silberschatz, Korth and Sudarshan Constraints (Cont.) Participation Constraints The participation of an entity set E in a relationship set R is said to be total if every entity in E participates in at least one relationship in R. For example, we expect every loan entity to be related to at least one customer through the borrower relationship. If only some entities in E participate in relationship in R, the participation of entity set E in relationship R is said to be partial. For example, the participation of customer in the borrower relationship set is therefore set is therefore partial
Keys Entity Sets A super key of an entity set is a set of one or more attributes whose values uniquely determine each entity A candidate key of an entity set is a minimal super key Customer-id is candidate key of customer account-number is candidate key of account Although several candidate keys may exist, one of the candidate keys is selected to be the primary key Relationship Sets The combination of primary keys of the participating entity sets forms a super key of a relationship set Database System Concepts 2.14 OSilberschatz. Korth and Sudarshan
Database System Concepts 2.14 ©Silberschatz, Korth and Sudarshan Keys Entity Sets A super key of an entity set is a set of one or more attributes whose values uniquely determine each entity. A candidate key of an entity set is a minimal super key Customer-id is candidate key of customer account-number is candidate key of account Although several candidate keys may exist, one of the candidate keys is selected to be the primary key. Relationship Sets The combination of primary keys of the participating entity sets forms a super key of a relationship set
Keys(Cont) (customer-id, account-number is the super key of depositor NOTE. this means a pair of entity sets can have at most one relationship in a particular relationship set E.g. if we wish to track all access-dates to each account by each customer, we cannot assume a relationship for each access. We can use a multivalued attribute though Must consider the mapping cardinality of the relationship set when deciding the what are the candidate keys Need to consider semantics of relationship set in selecting A the primary key in case of more than one candidate key Database System Concepts 2.15 OSilberschatz. Korth and Sudarshan
Database System Concepts 2.15 ©Silberschatz, Korth and Sudarshan Keys (Cont.) (customer-id, account-number) is the super key of depositor NOTE: this means a pair of entity sets can have at most one relationship in a particular relationship set. E.g. if we wish to track all access-dates to each account by each customer, we cannot assume a relationship for each access. We can use a multivalued attribute though Must consider the mapping cardinality of the relationship set when deciding the what are the candidate keys Need to consider semantics of relationship set in selecting the primary key in case of more than one candidate key