Entity – Relationship Model
Database Design Requirement Analysis Conceptual Design Logical Design Schema Refinement Physical Design Security Design
ER Model Data can be described as Entities Relationships attributes
Types of attributes Single attribute Composite attribute Single – valued attribute Multi – valued attribute Stored attribute Derived attribute Complex attribute
Complex Attribute Example - AddressPhone {AddressPhone( {Phone(AreaCode,PhoneNumber)},Address (StreetAddress(Number,Street,ApartmentNumber),City,State,Zip) ) }
Entity Set Collection of all entities of the same type. customer
Relationship Set
Notations in ER Model
E-R Diagram Example
E-R Diagram Example
E-R Diagram Example
Degree of a Relationship Degree- number of participating entity types. Degree = 1 – unary Degree = 2 – binary Degree = 3 – ternary Degree = n – n-ary
Example - Unary
Example - Binary
Example - Ternary
Rolename Identifies the exact role in which the entity participates in the relationship.
Recursive Relationship
Mapping Cardinalities One to one One to many
Mapping Cardinalities Many to one Many to many
ADDITIONAL FEATURES OF THE ER MODEL Key Constraints
Participation Constraints Total Partial
Weak Entities
Class Hierarchies Specialization Generalization
Aggregation
Case Study – Internet Shop Requirement Analysis I would like my customers to be able to browse my catalog of books and place orders over the Internet. Currently, I take orders over the phone. I have mostly corporate customers who call me and give me the ISBN number of a book and a quantity; they often pay by credit card.
Case Study – Internet Shop I then prepare a shipment that contains the books they ordered. If I don't have enough copies in stock, I order additional copies and delay the shipment until the new copies arrive; I want to ship a customer's entire order together. My catalog includes all the books I sell.
Case Study – Internet Shop For each book, the catalog contains its ISBN number, title, author, purcha.se price, sales price, and the year the book was published. Most of my customers are regulars, and I have records with their names and addresses.
Case Study – Internet Shop Conceptual Design
ER Model for the company database