Beruflich Dokumente
Kultur Dokumente
Chapter Outline
Example Database Application (COMPANY)
ER Model Concepts
– Entities and Attributes
– Entity Types, Value Sets, and Key Attributes
– Relationships and Relationship Types
Data Modeling Using the – Weak Entity Types
Entity-Relationship (ER) Model – Roles and Attributes in Relationship Types
ER Diagrams - Notation
ER Diagram for COMPANY Schema
Alternative Notations – UML class diagrams, others
Requirements of the Company (oversimplified for – We store each EMPLOYEE’s social security number,
illustrative purposes) address, salary, gender, and birthdate. Each employee
works for one department but may work on several
– The company is organized into DEPARTMENTs.
projects. We keep track of the number of hours per
Each department has a name, number and an
week that an employee currently works on each
employee who manages the department. We keep
project. We also keep track of the direct supervisor
track of the start date of the department manager.
of each employee.
– Each department controls a number of PROJECTs.
Each project has a name, number and is located at a
– Each employee may have a number of
DEPENDENTs. For each dependent, we keep track
single location.
of their name, gender, birthdate, and relationship to
employee.
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 3-3 Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 3-4
Copyright © 2004 Pearson Education, Inc. Copyright © 2004 Pearson Education, Inc.
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 3-5 Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 3-6
Copyright © 2004 Pearson Education, Inc. Copyright © 2004 Pearson Education, Inc.
1
8/30/2018
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 3-7 Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 3-8
Copyright © 2004 Pearson Education, Inc. Copyright © 2004 Pearson Education, Inc.
ENTITY TYPE
CAR
WEAK ENTITY TYPE
Registration(RegistrationNumber, State), VehicleID, Make, Model, Year, (Color)
RELATIONSHIP TYPE
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 3-11 Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 3-12
Copyright © 2004 Pearson Education, Inc. Copyright © 2004 Pearson Education, Inc.
2
8/30/2018
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 3-13 Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 3-14
Copyright © 2004 Pearson Education, Inc. Copyright © 2004 Pearson Education, Inc.
Example relationship instances of the WORKS_FOR Example relationship instances of the WORKS_ON
relationship between EMPLOYEE and DEPARTMENT relationship between EMPLOYEE and PROJECT
EMPLOYEE WORKS_FOR DEPARTMENT
r9
e1 d1 e1 r1 p1
r1
e2 e2
r2 r2
e3 d2 e3 p2
r3 r3
e4 e4
r4 d3 e5 r4 p3
e5
e6 r5 e6 r5
e7 e7 r6
r6
r7 r8 r7
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 3-15 Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 3-16
Copyright © 2004 Pearson Education, Inc. Copyright © 2004 Pearson Education, Inc.
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 3-17 Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 3-18
Copyright © 2004 Pearson Education, Inc. Copyright © 2004 Pearson Education, Inc.
3
8/30/2018
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 3-21 Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 3-22
Copyright © 2004 Pearson Education, Inc. Copyright © 2004 Pearson Education, Inc.
r8 r7
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 3-23 Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 3-24
Copyright © 2004 Pearson Education, Inc. Copyright © 2004 Pearson Education, Inc.
4
8/30/2018
e1 2
1 r1
e2 2
1 r2
e3 2
1 r3
e4
2
e5 1
1 r4
e6 2
1
e7 r5
2
r6
© The Benjamin/Cummings Publishing Company, Inc. 1994, Elmasri/Navathe, Fundamentals of Database Systems, Second Edition
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 3-25 Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 3-26
Copyright © 2004 Pearson Education, Inc. Copyright © 2004 Pearson Education, Inc.