Download presentation
Presentation is loading. Please wait.
Published byPhoebe Johns Modified over 9 years ago
1
CS 564 Database Management Systems: Design and Implementation
Arun Kumar Lecture 1: Entity-Relationship Modeling Chapter 2 in Cow Book Slide ACKs: AnHai Doan, Jeff Naughton, and Jignesh Patel
2
Database Design Process: ~6 steps
Requirements Analysis Conceptual Database Design Logical Database Design Schema Refinement Physical Database Design Application and Security Design
3
Database Design Process: ~6 steps
Requirements Analysis Conceptual Database Design Logical Database Design Schema Refinement Physical Database Design Application and Security Design Entity Relationship Modeling Relational Model and Normalization Indexing, etc.
4
ER Model Basics: Entity
Entity: Distinguishable abstract real-world object An entity has several “Attributes” An attribute has a “Domain” A collection of similar entities is an “Entity Set” An entity set might have a “Key” attribute SID Name Age Student
5
ER Model Basics: Relationship
Relationship: Association among ≥ 2 entities “Relationship Set” defined similarly SID Name Age DID Name Address Student Department Major EnrollDate
6
ER Model Basics: Relationship Set
Mathematically, given entity sets A and B, a relationship set on A and B is a subset of A X B Student s2 s3 d2 d3 Department d1 s1 s4 Enroll relation: {(s1, d1), (s2, d1), (s3, d2), (s4, d3)}
7
Relationships in ER Multiple Relationships
Multiplicity of Relationships Multi-way Relationships Self Relationships Multi-way to Binary Conversion
8
Multiple Relationships
SID Name Age DID Name Address Major Student Department Advise Employ PID Name Age Professor
9
Multiplicity of Relationships
b2 b3 b1 a1 a4 Student Department Many-to-one a2 a3 b2 b3 b1 a1 a4 Professor Department Many-to-many a2 a3 b2 b3 b1 a1 a4 Student Citizen One-to-one
10
Many-to-One and One-to-One in ER
SID Name Age DID Name Address Major Student Department Arrow: Each Student appears at most once in Enroll, i.e., given a Student, the Department is unique (no double majors!) Student Name Age SID Citizen Address DID Match Q: How is Many-to-Many depicted?
11
The Cow Book denotes the above as follows:
CAUTION: Difference with the Book SID Name Age DID Name Address Major Student Department The Cow Book denotes the above as follows: Student Name Age SID Department Address DID Major
12
Multi-way (n-ary) Relationships
PID Name Age CID Name Credits Professor Course Teach Room DID Number Seats
13
Multi-way (n-ary) Relationships
PID Name Age CID Name Credits Professor Course Teach Q: What does this mean? Room DID Number Seats
14
If “roles” are different,
Self Relationships PID Name Age CID Name Credits Professor Course Teach PI Co-PI Collaborate Room DID Number Seats If “roles” are different, label the edges
15
Multi-way to Binary Conversion
Professor Course Teach Professor Course Room InRoom ByProf OfCourse Teach Room Q: Why do we need these arrows?
16
Apart from types of Relationships, ER model can also capture Constraints
17
Constraints in ER Key: Uniquely identifies an entity
Participation: Total or Partial Referential Integrity: Relationship “validity” Single-value Constraint Domain Constraints
18
Constraints: Key Student Room SID Name Age DID Number Seats
Q: What does this mean?
19
Constraints: Participation
Professor Name Age PID Department Address DID Employ Thick: Each Professor must appear at least once in Employ Student Name Age SID Department Address DID Major Q: So, what does this mean?
20
Constraints: Referential Integrity
Professor Name Age PID Department Address DID Employ Curve: Each Professor must have a valid Department in Employ Student Name Age SID Department Address DID Major Q: So, what does this mean?
21
Advanced ER Concepts Weak Entities: an entity dependent on another
Hierarchies: “Is a” relationships among entities
22
Advanced: Weak Entity PartOf Floor Department Number NumRooms DID Name
Address PartOf Floor Department Thick/double lined shapes: Weak Entity and “dependency” DID and Number together are the Key for Floor Q. Why arrow, curve, and think line from Floor to PartOf? Q: Is a floor number ever meaningful without the Department?
23
Advanced: “Is A” Hierarchy
Analogy: Sub-class Inheritance in PL SID Name Age Student IsA IsHonors QualScore Masters Undergrad Doctoral ByThesis
24
General ER Design Philosophy
Follow Conventions Convey All App Constraints Avoid Redundancy Prefer Attributes over Trivial Entities
25
1. Follow Conventions Major Student Department Major Student
26
2. Convey All Application Constraints
PID Name Age DID Name Address Employ Professor Department Q. What all constraints are missing here?
27
3. Avoid Redundancy Major Student Department SID Name Age DID Name
Address Major Student Department DeptNAme
28
4. Prefer Attributes over Trivial Entities
SID Name Age Name Major Student Department Q. What is wrong with the above? Student Name Age SID MajorDeptName
29
Review: ER Model Entity, Relationships Constraints
Weak Entities; “IsA” Hierarchies Design Philosophy
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.