Professional Documents
Culture Documents
Chapter 3-2
Chapter 3-3
ER Model Concepts
Entities and Attributes
Entities are specific objects or things in the mini-world that are represented in the database. For example the EMPLOYEE John Smith, the Research DEPARTMENT, the ProductX PROJECT Attributes are properties used to describe an entity. For example an EMPLOYEE entity may have a Name, SSN, Address, Sex, BirthDate A specific entity will have a value for each of its attributes. For example a specific employee entity may have Name='John Smith', SSN='123456789', Address ='731, Fondren, Houston, TX', Sex='M', BirthDate='09-JAN-55 Each attribute has a value set (or data type) associated with it e.g. integer, string, subrange, enumerated type,
Chapter 3-4
Composite
The attribute may be composed of several components. For example, Address (Apt#, House#, Street, City, State, ZipCode, Country) or Name (FirstName, MiddleName, LastName). Composition may form a hierarchy where some components are themselves composite.
Multi-valued
An entity may have multiple values for that attribute. For example, Color of a CAR or PreviousDegrees of a STUDENT. Denoted as {Color} or {PreviousDegrees}.
Chapter 3-5
Chapter 3-6
Chapter 3-7
. . .
Chapter 3-8
E1 E1
R R R
E2
N
(min,max)
TOTAL PARTICIPATION OF E2 IN R CARDINALITY RATIO 1:N FOR E1:E2 IN R STRUCTURAL CONSTRAINT (min, max) ON PARTICIPATION OF E IN R
E2 E
Chapter 3-9
Chapter 3-10
Chapter 3-11
Example relationship instances of the WORKS_FOR relationship between EMPLOYEE and DEPARTMENT
EMPLOYEE
e1 e2 e3 e4 e5 e6 e7
WORKS_FOR
r1
r2 r3
DEPARTMENT
d1
d2
r4
r5 r6 r7
d3
Chapter 3-12
Example relationship instances of the WORKS_ON relationship between EMPLOYEE and PROJECT
r9 e1
e2 e3 e4 e5 e6 e7
r1
r2 r3 r4 r5 r6
p1
p2
p3
r8
r7
Chapter 3-13
Chapter 3-14
Chapter 3-15
Chapter 3-16
Chapter 3-17
Constraints on Relationships
Constraints on Relationship Types
( Also known as ratio constraints ) Maximum Cardinality
One-to-one (1:1) One-to-many (1:N) or Many-to-one (N:1) Many-to-many
Chapter 3-18
WORKS_FOR
r1
r2 r3
DEPARTMENT
d1
d2
r4
r5 r6 r7
d3
Chapter 3-19
r1
r2 r3 r4 r5 r6
p1
p2
p3
r8
r7
Chapter 3-20
Chapter 3-21
SUPERVISION
r1
2
1 2
2
r6
The Benjamin/Cummings Publishing Company, Inc. 1994, Elmasri/Navathe, Fundamentals of Database Systems, Second Edition
Chapter 3-22
Recursive Relationship Type is: SUPERVISION (participation role names are shown)
Chapter 3-23
A relationship type can have attributes; for example, HoursPerWeek of WORKS_ON; its value for each relationship instance describes the number of hours per week that an EMPLOYEE works on a PROJECT.
Chapter 3-24
Chapter 3-25
Participation constraint (on each participating entity type): total (called existence dependency) or partial.
SHOWN BY DOUBLE LINING THE LINK
Chapter 3-26
Chapter 3-27
(1,1)
(1,N)
Chapter 3-28
Chapter 3-29
Relationship types of degree 2 are called binary Relationship types of degree 3 are called ternary and of degree n are called n-ary In general, an n-ary relationship is not equivalent to n binary relationships
Chapter 3-30
relationship. (b) Three binary relationship s not equivalent to SUPPLY. (c) SUPPLY represented as a
Slide 4-31
An entity that is member of a subclass inherits all attributes of the entity as a member of the superclass It also inherits all relationships
Specialization
Is the process of defining a set of subclasses of a superclass The set of subclasses is based upon some distinguishing characteristics of the entities in the superclass Example: {SECRETARY, ENGINEER, TECHNICIAN} is a specialization of EMPLOYEE based upon job type. May have several specializations of the same superclass Example: Another specialization of EMPLOYEE based in method of pay is {SALARIED_EMPLOYEE, HOURLY_EMPLOYEE}. Superclass/subclass relationships and specialization can be diagrammatically represented in EER diagrams Attributes of a subclass are called specific attributes. For example, TypingSpeed of SECRETARY The subclass can participate in specific relationship types. For example, BELONGS_TO of HOURLY_EMPLOYEE
Example of a Specialization
Generalization
The reverse of the specialization process Several classes with common features are generalized into a superclass; original classes become its subclasses Example: CAR, TRUCK generalized into VEHICLE; both CAR, TRUCK become subclasses of the superclass VEHICLE.
We can view {CAR, TRUCK} as a specialization of VEHICLE Alternatively, we can view VEHICLE as a generalization of CAR and TRUCK
Completeness Constraint:
Total specifies that every entity in the superclass must be a member of some subclass in the specialization/ generalization Shown in EER diagrams by a double line Partial allows an entity not to belong to any of the subclasses Shown in EER diagrams by a single line
Note: Generalization usually is total because the superclass is derived from the subclasses.
Note: The difference from shared subclass, which is subset of the intersection of its superclasses (shared subclass member must exist in all of its superclasses).
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition
Copyright 2004 Pearson Education, Inc.
POSITIVES: serves as documentation of application requirements, easy user interface - mostly graphics editor support
Chapter 3-52
METHODOLGY
lack of built-in methodology support. poor tradeoff analysis or user-driven design preferences. poor design verification and suggestions for improvement.
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition
Copyright 2004 Pearson Education, Inc.
Chapter 3-53
Oracle Popkin Software Platinum Technology Persistence Inc. Rational Rogue Ware Resolution Ltd. Sybase Visio
Mapping from O-O to relational model Modeling in UML and application generation in C++ and JAVA Mapping from O-O to relational model Conceptual modeling up to code maintenance Data modeling, business logic modeling Data modeling, design and reengineering Visual Basic and Visual C++
Chapter 3-54
The Benjamin/Cummings Publishing Company, Inc. 1994, Elmasri/Navathe, Fundamentals of Database Systems, Second Edition
Chapter 3-55
THE ENTITY RELATIONSHIP MODEL IN ITS ORIGINAL FORM DID NOT SUPPORT THE SPECIALIZATION/ GENERALIZATION ABSTRACTIONS
Chapter 3-56