Entity-Relationship Model123
Entity-Relationship Model123
and Normalization
Modeling
• A database can be modeled as:
• a collection of entities,
• relationship among entities.
• An entity is an object that exists and is distinguishable from
other objects.
• Example: specific person, company, event, plant
• Entities have attributes
• Example: people have names and addresses
• An entity set is a set of entities of the same type that share the
same properties.
• Example: set of all persons, companies, trees, holidays
customer_id customer_name customer_street customer_city loan_number amount
Relationship Sets
• A relationship is an association among several entities
Example:
Hayes borrower L-14
Note: Some elements in A and B may not be mapped to any elements in the other set
Mapping Cardinalities
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.
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
• 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
• Need to consider semantics of relationship set in selecting the
primary key in case of more than one candidate key
E-R Diagrams