Entity type

COP 3540 - Introduction to Database Structures
DBMS Design, ER Model
ER Model
ER model is a top-down approach to database design
that begins by identifying important data called entities
and relationship between the data that must be
represented in the model.
We then add more details, such as attributes and any
constraints on the entities, relationships, and attributes.
ER Model
Entity type represents a group of objects in the real
world with the same properties.
Relationship type is a set of associations between
one or more participating entity types. Normally, a
relationship is named using a verb (e.g., supervises or
managers)
Attributes is a property of an entity or a relationship
type.
Domain is a set of allowable values for one or more
attributes.
ER Model
Attribute can be classified as being: simple or
composite, single-valued or multi-valued, or derived.
 Single attribute is composed of a single component with an
independent existence.
 Composite attribute is composed of multiple components,
each with an independent existence.
 Single-valued attribute holds a single value for each
occurrence of an entity type.
 Multi-valued attribute holds multiple values for each
occurrence of an entity type.
 Derived attribute represents a value that is derivable from the
value of a related attribute or set of attributes, not necessarily in
the same entity type.
ER Model
Example of Derived attribute
1) The value of the duration attribute of the Lease
entity is calculated from rentStart and rentFinish
attributes of the Lease entity type.
2) The total number of staff (totalStaff) attribute of the
Staff entity type can be calculated by counting the
total number of Staff entity occurrences.
3) The value of the deposit attribute of the Lease entity
type is derived from the rent attribute of the
PropertyForRent entity type.
ER Model
Candidate key is the minimal set of attributes that
uniquely identifies each occurrence of an entity type.
Composite key is a candidate key that consists of
two or more attributes.
Primary key is the candidate key that is selected to
uniquely identify each occurrence of an entity type.
The choice of primary key for an entity is based on
considerations of attribute length, the minimal number
of attributes required, and the future certainty of
uniqueness.
ER Model
Weak entity type is an entity type that is existencedependent on some other entity type.
 A characteristic of a weak entity is that each entity
occurrence cannot be uniquely identified using only the
attributes associated with that entity type.
 Weak entity types are sometimes referred to as child,
dependent, or subordinates entities and strong entity
types as parent, owner, or dominant entities.
ER Model
 The degree of a relationship is the number of entity types
that participate in that relationship (e.g., binary unary, and
ternary).
 Cardinality describes the maximum number of possible
relationship occurrence for an entity participating in a given
relation types.
 Binary relationships are generally referred to as being oneto-one (1:1), one-to-many (1:*), or many-to-many (*:*).
Example)
1) A member of staff manages a branch.
2) A member of staff oversees properties for rent.
3) Newspapers advertise for rent.
ER Model
 Participation determines whether all or only some entity
occurrences participate in a relationship.
Example
Branch
 Which one is better?
Division
Staff
Staff
Has
Division
Operators
Branch
Division
Operators
Branch
Has
Staff
Example
 Which one is better?
Branch
Has
Staff
Oversees
Property
For Rent
Branch
Has
Staff
Oversees
Property
For Rent
Offers
Example
 The entity sets are Movies, Stars, and Studios.
name
address
Stars
name
Stars-in
title
year
Movies
address
length
Studios
Owns
genre