100% found this document useful (1 vote)
2K views10 pages

Entity Relationship Diagram - ER Diagram

An entity-relationship (ER) diagram visually depicts the entities, attributes, and relationships within a database. The document defines an ER diagram as showing the relationships among entity sets, with entities represented by rectangles and relationships shown as diamonds. Attributes are represented by ovals. A sample ER diagram shows the entities of Student and College with a many-to-one relationship, indicating that a college can have many students but a student can only belong to one college.

Uploaded by

Swati Hans
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
2K views10 pages

Entity Relationship Diagram - ER Diagram

An entity-relationship (ER) diagram visually depicts the entities, attributes, and relationships within a database. The document defines an ER diagram as showing the relationships among entity sets, with entities represented by rectangles and relationships shown as diamonds. Attributes are represented by ovals. A sample ER diagram shows the entities of Student and College with a many-to-one relationship, indicating that a college can have many students but a student can only belong to one college.

Uploaded by

Swati Hans
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Entity Relationship Diagram – ER Diagram

An Entity–relationship model (ER model) describes the structure of a database with the


help of a diagram, which is known as Entity Relationship Diagram (ER Diagram). An ER
model is a design or blueprint of a database that can later be implemented as a database. The
main components of E-R model are: entity set and relationship set.

What is an Entity Relationship Diagram (ER Diagram)?

An ER diagram shows the relationship among entity sets. An entity set is a group of similar
entities and these entities can have attributes. In terms of DBMS, an entity is a table or
attribute of a table in database, so by showing relationship among tables and their attributes,
ER diagram shows the complete logical structure of a database.

An e-r diagram has following features:


 E-R diagrams are used to represent E-R model in a database, which makes them easy to
be converted into relations (tables).
 E-R diagrams provide the purpose of real-world modeling of objects which makes them
intently useful.
 E-R diagrams require no technical knowledge & no hardware support.
 These diagrams are very easy to understand and easy to create even by a naive user.
 It gives a standard solution of visualizing the data logically.

A simple ER Diagram:

In the following diagram we have two entities Student and College and their relationship. The
relationship between Student and College is many to one as a college can have many students
however a student cannot study in multiple colleges at the same time. Student entity has
attributes such as Stu_Id, Stu_Name & Stu_Addr and College entity has attributes such as
Col_ID & Col_Name.

Here are the geometric shapes and their meaning in an E-R Diagram.
ER model symbols:

Symbol Shape Name Symbol Description


Entities

An entity is represented by a rectangle which


Entity
contains the entity’s name.

An entity that cannot be uniquely identified by its


attributes alone. The existence of a weak entity is
dependent upon another entity called the owner
Weak Entity
entity. The weak entity’s identifier is a combination
of the identifier of the owner entity and the partial
key of the weak entity.
Attributes

Each attribute is represented by an oval containing


Attribute
attribute’s name

Key An attribute that uniquely identifies a particular


attribute entity. The name of a key attribute is underlined.

Multivalued An attribute that can have many values Multivalued


attribute attribute is depicted by a dual oval.

An attribute whose value is calculated (derived)


from other attributes. The derived attribute may or
may not be physically stored in the database. This
Derived
attribute is represented by dashed oval.
attribute

Relationships

A relationship where entity is existence-independent


Strong
of other entities,a strong relationship is represented
relationship
by a single rhombus
Weak A relationship where Child entity is existence-
(identifying) dependent on parent. This relationship is
relationship represented by a double rhombus.

Components of ER Diagram

As shown in the above diagram, an ER diagram has three main components:


1. Entity
2. Attribute
3. Relationship

1. Entity

An entity is an object or component of data. An entity is represented as rectangle in an ER


diagram.
For example: In the following ER diagram we have two entities Student and College and
these two entities have many to one relationship as many students study in a single college.

Weak Entity:
An entity that cannot be uniquely identified by its own attributes and relies on the
relationship with other entity is called weak entity. The weak entity is represented by a
double rectangle. For example – a bank account cannot be uniquely identified without
knowing the bank to which the account belongs, so bank account is a weak entity.

2. Attribute

An attribute describes the property of an entity. An attribute is represented as Oval in an ER


diagram. There are four types of attributes:

1. Key attribute
2. Composite attribute
3. Multivalued attribute
4. Derived attribute

1. Key attribute:

A key attribute can uniquely identify an entity from an entity set. For example, student roll
number can uniquely identify a student from a set of students. Key attribute is represented by
oval same as other attributes however the text of key attribute is underlined.

2. Composite attribute:

An attribute that is a combination of other attributes is known as composite attribute. For


example, In student entity, the student address is a composite attribute as an address is
composed of other attributes such as pin code, state, country.
3. Multivalued attribute:

An attribute that can hold multiple values is known as multivalued attribute. It is represented
with double ovals in an ER Diagram. For example – A person can have more than one phone
numbers so the phone number attribute is multivalued.

4. Derived attribute:

A derived attribute is one whose value is dynamic and derived from another attribute. It is
represented by dashed oval in an ER Diagram. For example – Person age is a derived
attribute as it changes over time and can be derived from another attribute (Date of birth).

E-R diagram with multivalued and derived attributes:

3. Relationship

A relationship is represented by diamond shape in ER diagram, it shows the relationship


among entities.

Cardinality defines the possible number of occurrences in one entity is having relationship


with the number of occurrences in another. For example, ONE team has MANY players.
When present in an ERD, the entity Team and Player are inter-connected with a one-to-
many relationship.

There are four types of cardinality associated with relationship :


1. One to One
2. One to Many
3. Many to One
4. Many to Many

1. One to One Relationship

When a single instance of an entity is associated with a single instance of another entity then
it is called one to one relationship. For example, a person has only one passport and a
passport is given to one person.

2. One to Many Relationship


When a single instance of an entity is associated with more than one instances of another
entity then it is called one to many relationship. For example – a customer can place many
orders but a order cannot be placed by many customers.

3. Many to One Relationship

When more than one instances of an entity is associated with a single instance of another
entity then it is called many to one relationship. For example – many students can study in a
single college but a student cannot study in many colleges at the same time.

4. Many to Many Relationship

When more than one instances of an entity is associated with more than one instances of
another entity then it is called many to many relationship. For example, a can be assigned to
many projects and a project can be assigned to many students.

 Degree of relationship:- It signifies the number of entities involved in a relationship. Degree of


a relationship can be classified into following types:

 Unary relationship:- If only single entity is involved in a relationship then it is a unary


relationship. For example, An employee(manager) supervises another employee.

 Binary relationships:- when two entities are associated to form a relation, then it is
known as a binary relationship. For example, student enrolled in course shown below
signifies a binary relationship
.

 Ternary:- As the name signifies, a ternary relationship is associated with three entities

Participation Constraints

1. Total Participation – Each entity in the entity set must participate in the


relationship. If each student must enroll in a course, the participation of student will be
total. Total participation is shown by double lines in ER diagram.

2. Partial Participation – The entity in the entity set may or may NOT participate
in the relationship. If some courses are not enrolled by any of the student, the
participation of course will be partial. Partial participation is represented by single
lines.

The diagram depicts the ‘Enrolled in’ relationship set with Student Entity set having
total participation and Course Entity set having partial participation.
Examples of ER diagram

1. ER diagram for student enrollment system


2.E-R diagram of hospital management system
3.ER diagram of Employee Management system

You might also like