The Enity Relationship Model
The Enity Relationship Model
However, for complex apps, their databases are often highly complex.
Often no one person understands the complete data needs of the
application.
Student Course
2. ENTITY SET
An entity set is a set of entities of the same type that
share the same properties.
Example: Computer Science students are an entity set of
the entity student. Physics, Chemistry and Biology is an
entity set of the entity course.
Diagrammatically represented by a vertical oval:
Amina
Boniface Entity set of Student entity
Aisha
3. ATTRIBUTE
Attributes are the properties of an entity. For example,
Roll_No, Name, DOB, Age, Address, Mobile_No are the
attributes of the entity Student. In ER diagram, attribute
is represented by an oval.
Name
3.1 KEY ATTRIBUTE
The attribute which uniquely identifies each entity in the
entity set is called key attribute. For example ID of student is
unique for each student. In ER diagram, key attribute is
represented by an oval with underlying lines.
ID
3.2 COMPOSITE ATTRIBUTE
An attribute composed of many other attribute is called as composite
attribute. For example, Address attribute of student Entity consists of Street,
City, State, and Country. In ER diagram, composite attribute is represented by an
oval comprising of ovals.
3.3 MULTIVALUED ATTRIBUTE
An attribute consisting more than one value for a given entity. For example,
Phone_No (can be more than one for a given student). In ER diagram,
multivalued attribute is represented by double oval.
3.4 DERIVED ATTRIBUTE
An attribute which can be derived from other attributes of the entity type is
known as derived attribute. e.g.; Age (can be derived from DOB). In ER diagram,
derived attribute is represented by dashed oval.
The complete entity Student with its attributes can be
represented as:
4. RELATIONSHIP
A relationship represents the association between
entities. For example, ‘Enrolled in’ is a relationship type
that exists between entity type Student and Course. In
ER diagram, relationship type is represented by a
diamond and connecting the entities with lines.
4. RELATIONSHIP…
A relationship can also have an attribute. Consider a
movie renting app. The relationship Rent has an
attribute called Rent_Date which is the date the movie
was rented. Some people call these relationships that
have attributes as Associative Entities
4.1 RELATIONSHIP SET
A set of relationships of same type is known as
relationship set. The following relationship set depicts S1
is enrolled in C2, S2 is enrolled in C1 and S3 is enrolled
in C3.
4.2 DEGREE OF RELATIONSHIP SET
The number of different entity sets participating in a
relationship set is called as degree of a relationship
set.
1. Unary Relationship –
When there is only ONE entity set participating
in a relation, the relationship is called as unary
relationship. For example, one person is married to
only one person.
4.2 DEGREE OF RELATIONSHIP SET…
2. Binary Relationship –
When there are TWO entities set participating in
a relation, the relationship is called as binary
relationship. For example, Student is enrolled in
Course.
4.2 DEGREE OF RELATIONSHIP SET…
3. n-ary Relationship –
When there are n entities set participating in a
relation, the relationship is called as n-ary
relationship. For example if n is 3, the relationship is
called ternary relationship.
Many to one
Many to many
5.1 ONE-TO-ONE
A single entity of first entity set associates with single
entity of second entity set.