Académique Documents
Professionnel Documents
Culture Documents
Fall 2014
1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw Hill, Cengage Learning
Slides adapted and modified from Fundamentals of Database Systems (5/6) (Elmasri et al.), Database System
Concepts (5/6) (Silberschatz et al.), Database Systems (Coronel et al.), Database Systems (4/5) (Connolly et al. ),
Database Systems: Complete Book (Garcia-Molina et al.)
ideas
High-Level
Design
Relational
Database
Schema
Relational
DBMS
3
1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw Hill, Cengage Learning
Slides adapted and modified from Fundamentals of Database Systems (5/6) (Elmasri et al.), Database System Concepts (5/6)
(Silberschatz et al.), Database Systems (Coronel et al.), Database Systems (4/5) (Connolly et al. ), Database Systems: Complete Book
(Garcia-Molina et al.)
1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw Hill, Cengage Learning
Slides adapted and modified from Fundamentals of Database Systems (5/6) (Elmasri et al.), Database System Concepts (5/6)
(Silberschatz et al.), Database Systems (Coronel et al.), Database Systems (4/5) (Connolly et al. ), Database Systems: Complete Book
(Garcia-Molina et al.)
ER Model Overview
Three Principal Element Types
Entities and Entity Sets
Attributes
Relationships
1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw Hill, Cengage Learning
Slides adapted and modified from Fundamentals of Database Systems (5/6) (Elmasri et al.), Database System Concepts (5/6)
(Silberschatz et al.), Database Systems (Coronel et al.), Database Systems (4/5) (Connolly et al. ), Database Systems: Complete Book
(Garcia-Molina et al.)
Simple/composite:
Deals with attribute
type
Single/multivalued:
Deals with attribute
values
Stored/derived:
Deals with how
attribute value is
obtained
Categories of Attributes
Simple (atomic) attributes vs. composite attributes
Single-valued attributes vs. multivalued attributes
Stored attributes vs. derived attributes
Categories of Attributes
Composite vs. Simple (Atomic) Attributes
Composite Attributes
Can be divided into smaller subparts, which represent more basic attributes with
independent meanings
Composite attributes can form a hierarchy: the value of a composite attribute is the
concatenation of the values of its component simple attributes
If the composite attribute is referenced only as a whole, there is no need to subdivide it
into component attributes
1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw Hill, Cengage Learning
Slides adapted and modified from Fundamentals of Database Systems (5/6) (Elmasri et al.), Database System Concepts (5/6)
(Silberschatz et al.), Database Systems (Coronel et al.), Database Systems (4/5) (Connolly et al. ), Database Systems: Complete Book
(Garcia-Molina et al.)
Categories of Attributes
Single-valued vs. Multivalued Attributes
Single Attributes
Multivalued Attributes
In some cases, an attribute can have a set of values for the same entity
Example: a Colors attribute for a car
Example: Different people can have numbers of values for the College_degrees attribute
Multivalued attribute can have lower and upper bounds to constrain the number of values
allowed for each individual entity
Example: the Colors attribute of a car may be restricted to have between one and three
values (assuming that a car can have three colors at most)
10
Categories of Attributes
Stored vs. Derived Attributes
Stored vs. Derived Attributes
In some cases, two (or more) attribute values are related
Consider Age and Birth_date attributes of a person
The value of Age can be determined from the current (todays) date
and the value of that persons Birth_date
Age attribute is hence called a derived attribute and is said to be
derivable from the Birth_date attribute, which is called a stored
attribute
Some attribute values can be derived from related entities (Example:
NumberOfEmployees)
11
1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw Hill, Cengage Learning
Slides adapted and modified from Fundamentals of Database Systems (5/6) (Elmasri et al.), Database System Concepts (5/6)
(Silberschatz et al.), Database Systems (Coronel et al.), Database Systems (4/5) (Connolly et al. ), Database Systems: Complete Book
(Garcia-Molina et al.)
NULL Values
NULL Values
In some cases, a particular entity may not have an applicable value for
an attribute
Example:
Entity Sets
Entity type (or entity set)
Collection (or set) of similar entities that have the same attributes
An entity type describes the schema or intension of a set of entities
that share the same structure
The collection of entities of a particular entity type is grouped into an
entity set (also known as the extension of the entity type)
13
1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw Hill, Cengage Learning
Slides adapted and modified from Fundamentals of Database Systems (5/6) (Elmasri et al.), Database System Concepts (5/6)
(Silberschatz et al.), Database Systems (Coronel et al.), Database Systems (4/5) (Connolly et al. ), Database Systems: Complete Book
(Garcia-Molina et al.)
1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw Hill, Cengage Learning
Slides adapted and modified from Fundamentals of Database Systems (5/6) (Elmasri et al.), Database System Concepts (5/6)
(Silberschatz et al.), Database Systems (Coronel et al.), Database Systems (4/5) (Connolly et al. ), Database Systems: Complete Book
(Garcia-Molina et al.)
16
Employee has one key, dependent has none, department and project
have two keys
17
1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw Hill, Cengage Learning
Slides adapted and modified from Fundamentals of Database Systems (5/6) (Elmasri et al.), Database System Concepts (5/6)
(Silberschatz et al.), Database Systems (Coronel et al.), Database Systems (4/5) (Connolly et al. ), Database Systems: Complete Book
(Garcia-Molina et al.)
Dependent is meaningless in
COMPANY DB independently
of Employee
Identified by relationship
to Employee
Dependent_name distinguishes
one dependent from other
dependents for the same
employee: partial key
Identifying relationship
Relates a weak entity type to the identifying entity, which has the rest of the key
18
1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw Hill, Cengage Learning
Slides adapted and modified from Fundamentals of Database Systems (5/6) (Elmasri et al.), Database System Concepts (5/6)
(Silberschatz et al.), Database Systems (Coronel et al.), Database Systems (4/5) (Connolly et al. ), Database Systems: Complete Book
(Garcia-Molina et al.)
Relationships in General
Relationship
Examples:
20
Relationships
Relationship
Relationship instance ri
Each ri associates n individual entities (e1, e2, ..., en)
Each entity ej in ri is a member of entity set Ej
Relationships uniquely identified by keys of participating entities
1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw Hill, Cengage Learning
Slides adapted and modified from Fundamentals of Database Systems (5/6) (Elmasri et al.), Database System Concepts (5/6)
(Silberschatz et al.), Database Systems (Coronel et al.), Database Systems (4/5) (Connolly et al. ), Database Systems: Complete Book
(Garcia-Molina et al.)
10
22
Relationships with
Repeated Entity Sets
Some relationships involve multiple
entities from the same entity set
e.g., spouse (two persons), games (two
teams)
e.g., recursive relationships, such as
supervises (two employees)
Recursive relationships
Role name
Signifies role that participating entity
plays in relationship instance
Required when entity type participates
multiple times in a relationship
23
1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw Hill, Cengage Learning
Slides adapted and modified from Fundamentals of Database Systems (5/6) (Elmasri et al.), Database System Concepts (5/6)
(Silberschatz et al.), Database Systems (Coronel et al.), Database Systems (4/5) (Connolly et al. ), Database Systems: Complete Book
(Garcia-Molina et al.)
11
Relationship Constraints
Cardinality ratio
Specifies maximum number of relationship instances in which each entity
can participate
Types 1:1, 1:N, or M:N
Participation constraint
Specifies whether existence of entity depends on its being related to
another entity
Types: total and partial
Thus, minimum number of relationship instances in which entities can
participate:
At least 1 for total participation
At least 0 for partial
Relationship Constraints
Partial Participation
If there is no participation constraint, it is possible that an entity will not
participate in a relationship set
E1
E2
Total Participation
If there is a participation constraint, an entity must participate at least once
Presented by double line from entity set to relationship set
E1
E2
1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw Hill, Cengage Learning
Slides adapted and modified from Fundamentals of Database Systems (5/6) (Elmasri et al.), Database System Concepts (5/6)
(Silberschatz et al.), Database Systems (Coronel et al.), Database Systems (4/5) (Connolly et al. ), Database Systems: Complete Book
(Garcia-Molina et al.)
12
Relationship Attributes
Relationship types can also have attributes
Property that depends on both/all participating entities
Example: Percentage of control that department has on a project
CONTROLS
Percent
1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw Hill, Cengage Learning
Slides adapted and modified from Fundamentals of Database Systems (5/6) (Elmasri et al.), Database System Concepts (5/6)
(Silberschatz et al.), Database Systems (Coronel et al.), Database Systems (4/5) (Connolly et al. ), Database Systems: Complete Book
(Garcia-Molina et al.)
13
1992-2014 by Addison Wesley & Pearson Education, Inc., McGraw Hill, Cengage Learning
Slides adapted and modified from Fundamentals of Database Systems (5/6) (Elmasri et al.), Database System Concepts (5/6)
(Silberschatz et al.), Database Systems (Coronel et al.), Database Systems (4/5) (Connolly et al. ), Database Systems: Complete Book
(Garcia-Molina et al.)
14