Entity Relationship(ER)
Overview
The Entity-Relationship(ER) model is one such mechanism. ER modeling is a top-down approach to database design that begins by identifying the important data called entities
and relationships
between the data that must be represented in the model. We then add more details such as the information (called attributes) we want to hold about the entities
and relationships
, and also the constraints
on relationships that describe how the entities are associated with each other such as cardinality and participation.
UML(Unified Modeling Language) is an oom language.
What is ER?
An approach, and mechanism use to define important data:
- entities
- attributes
- relationships
- constraints
How represent ER by using UML in ER diagram?
Entities
Entity types
- They are basic concepts of the ER model.
- A group of objects with the same properties, which are identifies by the enterprise as having an independent existence.
Strong entities vs Weak entities
Entity occurrence
- A uniquely identifiable object of an entity type(Each uniquely identifiable object of an entity is referred to simply as an entity occurrence)
Each uniquely identifiable object of an entity type is referred to simply as an entity occurrence
. However, we use more general term “entity” it is more obvious.
The first letter od each word in the entity name is uppercase
Relationship Types
Relationship type
- A set of meaningful associations among entity types
Multiplicity = Cardinality + Participation
Relationship
minimum..maximum
- entity(min..max)–relationship–(min..max)entity2
Partial Key
The set of attributes that are used to uniquely identify a weak entity set is called thr Partial key.
Self association
Relationship occurrence
- A uniquely identifiable association that includes one occurrence from rach participating entity type.
Normally, a relationship is named using a verb or a short phrase including a verb, first letter of its name is shown in uppercase.
A relationship is only labeled in one direction(the relationship only be used by one direction)
Degree of a relationship type
The number of participating entity types in a relationship type is called the degree of that relationship. And degree two is called binary.
Others are included tenary, quaternary.
Recursive relationship
A relationship type in which the same entity type participates more than once in different roles. Key word is supervisedBy
Attributes
Attribute
- A property of an entity or a relationship type
Attribute domain
- The set of allowable values for one or more attributes.
- Each attribute is associated with a set of values called a domain.
Simple attribute vs Composite attribute
- An attribute composed of a single component with an independent existence
- An attribute composed of multiple components, each with an independent existence