Mapping Cardinalities A B A B b1 01 al b2 02 2 03 03 04 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 -5th Edition,Oct 5,2006 6.12 @Silberschatz,Korth and Sudarshan
Database System Concepts - 5 6.12 ©Silberschatz, Korth and Sudarshan th Edition, Oct 5, 2006 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 01 01 2 a2 b2 3 a3 b3 04 b3 04 5 a (b) Many to one Many to many Note:Some elements in A and B may not be mapped to any elements in the other set Database System Concepts -5th Edition,Oct 5,2006 6.13 @Silberschatz,Korth and Sudarshan
Database System Concepts - 5 6.13 ©Silberschatz, Korth and Sudarshan th Edition, Oct 5, 2006 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
Keys 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. Database System Concepts-5th Edition,Oct 5,2006 6.14 @Silberschatz,Korth and Sudarshan
Database System Concepts - 5 6.14 ©Silberschatz, Korth and Sudarshan th Edition, Oct 5, 2006 Keys 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
Keys for Relationship Sets The combination of primary keys of the participating entity sets forms a super key of a relationship set. (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. Example: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 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 Database System Concepts-5th Edition,Oct 5,2006 6.15 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 5 6.15 ©Silberschatz, Korth and Sudarshan th Edition, Oct 5, 2006 Keys for Relationship Sets The combination of primary keys of the participating entity sets forms a super key of a relationship set. (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. Example: 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 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
E-R Diagrams customer_name customer_street loan_number amount customer_id customer_city customer borrower loan Rectangles represent entity sets. Diamonds represent relationship sets. Lines link attributes to entity sets and entity sets to relationship sets. Ellipses represent attributes Double ellipses represent multivalued attributes. Dashed ellipses denote derived attributes. Underline indicates primary key attributes(will study later) Database System Concepts-5th Edition,Oct 5,2006 6.16 @Silberschatz,Korth and Sudarshan
Database System Concepts - 5 6.16 ©Silberschatz, Korth and Sudarshan th Edition, Oct 5, 2006 E-R Diagrams Rectangles represent entity sets. Diamonds represent relationship sets. Lines link attributes to entity sets and entity sets to relationship sets. Ellipses represent attributes Double ellipses represent multivalued attributes. Dashed ellipses denote derived attributes. Underline indicates primary key attributes (will study later)