Entity-Relationship Model
2.1
Entity, Relationship, and E-R Diagram
2.2
E-R Diagrams
2.3
Entity Sets
2.4
Entity Sets customer and loan
customer-id customer- customer- customer- loan- amount� name street city number
2.5
Attributes
Example:
customer = (customer-id, customer-name, customer-street, customer-city)� loan = (loan-number, amount)
2.6
Composite Attributes
2.7
E-R Diagram With Composite, Multivalued, and Derived Attributes
2.8
Weak Entity and Regular/Strong Entity
2.9
Weak Entity and Regular/Strong Entity
2.10
2.11
Relationship Sets
Example:� Hayes depositor A-102� customer entity relationship set account entity
{(e1, e2, … en) | e1 ∈ E1, e2 ∈ E2, …, en ∈ En}��where (e1, e2, …, en) is a relationship
(Hayes, A-102) ∈ depositor
2.12
Relationship Set borrower
2.13
Relationship Sets (Cont.)
2.14
Degree of a Relationship Set
2.15
E-R Diagram with a Ternary Relationship
2.16
Binary Vs. Non-Binary Relationships
2.17
Roles
2.18
Mapping Cardinalities
2.19
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
2.20
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
2.21
Mapping Cardinality
2.22
One-To-Many Relationship
2.23
Many-To-One Relationships
2.24
Many-To-Many Relationship
2.25
Mapping Cardinalities affect ER Design
2.26
Relationship Sets with Attributes
2.27
Participation of an Entity Set in a Relationship Set
2.28
Keys
2.29
Keys for Relationship Sets
2.30
Keys in This Table
�
StudentID | Name | Phone | |
101 | Alice | 9876543210 | |
102 | Bob | 8765432109 | |
103 | Charlie | 7654321098 |
Example Table: Student
StudentID Name Email Phone
2.31
Recursive Relationship Type is: SUPERVISION�(participation role names are shown)
2.32
Attribute of a Relationship Type is: �Hours of WORKS_ON
2.33
COMPANY ER Schema Diagram� using (min, max) notation
2.34
ER DIAGRAM FOR A BANK �DATABASE
© The Benjamin/Cummings Publishing Company, Inc. 1994, Elmasri/Navathe, Fundamentals of Database Systems, Second Edition
2.35
Specialization
2.36
Specialization Example
2.37
Generalization
2.38
Specialization and Generalization (Contd.)
2.39
Design Constraints on a Specialization/Generalization
2.40
Design Constraints on a Specialization/Generalization (Contd.)
2.41
1. Disjoint Constraint
2. Overlapping Constraint
3. Completeness Constraint
�
2.42
Aggregation
2.43
Aggregation (Cont.)
2.44
E-R Diagram With Aggregation
2.45
E-R Design Decisions
2.46
E-R Diagram for a Banking Enterprise
2.47
Summary of Symbols Used in E-R Notation
2.48
Summary of Symbols (Cont.)
2.49
Alternative E-R Notations
2.50
Scenario 1: University Course Registration System
Activity Description:
Design an ER diagram for a university system that manages students, courses, professors, and registrations.
Entities and Attributes:
Relationships:
Special Features:
2.51
Type: Many-to-Many
Explanation: A student can register for multiple courses, and each course can have multiple students.
Resolution: This is resolved using the Registration entity, which includes attributes like Semester and Grade.
Attributes Involved:
Student: Student_ID, Name, Email, Department
Course: Course_ID, Title, Credits
Registration: Reg_ID, Semester, Grade
🔹 2. Course — Taught by — Professor
Type: Many-to-Many
Explanation: A course can be taught by multiple professors (e.g., co-teaching), and a professor can teach multiple courses.
Attributes Involved:
Professor: Prof_ID, Name, Specialization
2.52
🔹 3. Course — Belongs to — Department
Type: Many-to-One
Explanation: Each course is offered by one department, but a department can offer many courses.
Attributes Involved:
Department: Dept_ID, Name, Location
🔹 4. Student — Enrolled in — Department
Type: Many-to-One
Explanation: Each student is enrolled in one department, but a department can have many students.
🔹 Optional Enhancements:
Generalization: TeachingStaff ⟶ Professor, AssistantProfessor
Derived Attributes: GPA can be derived from grades in the Registration entity.
2.53
Scenario 2: E-Commerce Order Management System
Activity Description:
Design an ER diagram for an e-commerce platform that handles customers, products, orders, payments, and shipping.
Entities and Attributes:
Relationships:
Special Features:
2.54
1. Customer — Places — Order
Type: One-to-Many
Explanation: A single customer can place multiple orders, but each order is placed by one customer.
Attributes Involved:
Customer: Cust_ID (Primary Key)
Order: Order_ID, Order_Date, Status
2. Order — Contains — Product
Type: Many-to-Many
Explanation: An order can contain multiple products, and a product can be part of multiple orders.
Resolution: This relationship is typically resolved using a junction table or Order Details entity with attributes like quantity and price at the time of order.
Attributes Involved:
Product: Prod_ID, Name, Price
Order: Order_ID
2.55
3. Order — Has — Payment
Type: One-to-One
Explanation: Each order is associated with one payment transaction.
Attributes Involved:
Payment: Payment_ID, Method, Amount, Date.
🔹 4. Order — Has — Shipping
Type: One-to-One
Explanation: Each order has one shipping record detailing how and when it was shipped.
Attributes Involved:
Shipping: Ship_ID, Carrier, Tracking_No, Ship_Date
🔹 Optional Enhancements:
Product — Belongs to — Category (One-to-Many)
Customer — Has — Multiple Addresses
(Multivalued Attribute or separate Address entity)
2.56