5fd1c748-de47-491c-b051-20b34245982b

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

1

2
INDEX

Sr.No. Name of Points Page


No.

1. 4
Introduction

2. Working with ER Diagrams 6

3. 7
Components of ER Diagram

4. 17
Advantages of ER Model

5. 18
Disadvantages of ER Model

6. 19
Specifications of ER Diagram

7. Importance of Entity-Relationship diagram in 20


database design

6. 21
Conclusion

7. 22
Reference

3
Introduction

ER Diagram stands for Entity Relationship Diagram, also known as ERD is a


diagram that displays the relationship of entity sets stored in a database. In other
words, ER diagrams help to explain the logical structure of databases. ER diagrams
are created based on three basic concepts: entities, attributes and relationships.

ER Diagrams contain different symbols that use rectangles to represent entities,


ovals to define attributes and diamond shapes to represent relationships.

At first look, an ER diagram looks very similar to the flowchart. However, ER


Diagram includes many specialized symbols, and its meanings make this model
unique. The purpose of ER Diagram is to represent the entity framework
infrastructure.

4
Working with ER Diagrams

ER Diagram is a visual representation of data that describes how data is related to


each other. In ER Model, we disintegrate data into entities, attributes and setup
relationships between entities, all this can be represented visually using the ER
diagram.

For example, in the below diagram, anyone can see and understand what the diagram
wants to convey: Developer develops a website, whereas a Visitor visits a website.

5
Components of ER Diagram

Entity, Attributes, Relationships etc. form the components of ER Diagram and


there are defined symbols and shapes to represent each one of them.

Let's see how we can represent these in our ER Diagram.

Entity

Simple rectangular box represents an Entity.

Relationships between Entities - Weak and Strong

6
Rhombus is used to setup relationships between two or more entities.

Attributes for any Entity

Ellipse is used to represent attributes of any entity. It is connected to the entity.

Weak Entity

A weak Entity is represented using double rectangular boxes.


It is generally connected to another entity.

Key Attribute for any Entity

To represent a Key attribute, the attribute name inside the Ellipse is underlined.

7
Derived Attribute for any Entity

Derived attributes are those which are derived based on other attributes, for example,
age can be derived from date of birth.

To represent a derived attribute, another dotted ellipse is created inside the main
ellipse.

Multivalued Attribute for any Entity

Double Ellipse, one inside another, represents the attribute which can have multiple
values.

Composite Attribute for any Entity

A composite attribute is the attribute, which also has attributes.

8
ER Diagram: Entity

An Entity can be any object, place, person or class. In ER Diagram, an entity is


represented using rectangles. Consider an example of an Organization- Employee,
Manager, Department, Product and many more can be taken as entities in an
Organization.

The yellow rhombus in between represents a relationship.

ER Diagram: Weak Entity

Weak entity is an entity that depends on another entity. Weak entity doesn't have anay
key attribute of its own. Double rectangle is used to represent a weak entity.

ER Diagram: Attribute

9
An Attribute describes a property or characteristic of an entity. For example, Name,
Age, Address etc can be attributes of a Student. An attribute is represented using
eclipse.

ER Diagram: Key Attribute

Key attribute represents the main characteristic of an Entity. It is used to


represent a Primary key. Ellipse with the text underlined, represents Key Attribute.

10
ER Diagram: Composite Attribute

An attribute can also have their own attributes. These attributes are known as
Composite attributes.

ER Diagram: Relationship

A Relationship describes relation between entities.

Relationship is represented using diamonds or rhombus.

There are three types of relationship that exist between Entities.

11
1. Binary Relationship
2. Recursive Relationship

3. Ternary Relationship

ER Diagram: Binary Relationship

Binary Relationship means relation between two Entities. This is further divided
into three types.

One to One Relationship

This type of relationship is rarely seen in real world.

The above example describes that one student can enroll only for one course and a
course will also have only one Student. This is not what you will usually see in
real-world relationships.

One to Many Relationship

The below example showcases this relationship, which means that 1 student can opt
for many courses, but a course can only have 1 student. Sounds weird! This is how it is.

12
Many to One Relationship

It reflects business rule that many entities can be associated with just one entity.
For example, Student enrolls for only one Course but a Course can have many
Students.

Many to Many Relationship

The above diagram represents that one student can enroll for more than one courses.
And a course can have more than 1 student enrolled in it.

13
ER Diagram: Recursive Relationship

When an Entity is related with itself it is known as Recursive

Relationship. st

ER Diagram: Ternary Relationship

Relationship of degree three is called Ternary relationship.

A Ternary relationship involves three entities. In such relationships we always


consider two entities together and then look upon the third.

For example, in the diagram above, we have three related entities, Company, Product
and Sector. To understand the relationship better or to define rules around the model,
we should relate two entities and then derive the third one.

A Company produces many Products/ each product is produced by exactly one


company.

14
A Company operates in only one Sector / each sector has many companies operating
in it.

Considering the above two rules or relationships, we see that although the complete
relationship involves three entities, but we are looking at two entities at a time.

Advantages of ER Model

• Conceptually it is very simple: ER model is very simple because if we know


relationship between entities and attributes, then we can easily draw an ER

diagram.

• Better visual representation: ER model is a diagrammatic representation of any


logical structure of database. By seeing ER diagram, we can easily understand

relationship among entities and relationship.

• Effective communication tool: It is an effective communication tool for


database designer. It allows the readers to understand the relationship among
different fields in an effective manner. .

• Highly integrated with relational model: ER model can be easily converted into
relational model by simply converting ER model into tables.

• Easy conversion to any data model: ER model can be easily converted into
another data model like hierarchical data model, network data model and so on.

15
Disadvantages of ER Model

• Limited constraints and specification

• Loss of information content: Some information be lost or hidden in ER model

• Limited relationship representation: ER model represents limited relationship as


compared to another data models like relational model etc.

• No representation of data manipulation: It is difficult to show data manipulation


in ER model.

• Popular for high level design: ER model is very popular for designing high level
design

Specifications of ER Diagram

• An entity– relationship model (or ER model) describes interrelated things of


interest in a specific domain of knowledge. A basic ER model is composed of

16
entity types (which classify the things of interest) and specifies relationships
that can exist between entities (instances of those entity types).

• In software engineering, an ER model is commonly formed to represent things a


business needs to remember in order to perform business processes.
Consequently, the ER model becomes an abstract data model, that defines a
data or information structure which can be implemented in a database, typically
a relational database.

• Entity– relationship modeling was developed for database and design by Peter
Chen and published in a 1976 paper,[1] with variants of the idea existing
previously.[2] Some ER models show super and subtype entities connected by
generalization-specialization relationships,[3] and an ER model can be used also
in the specification of domain-specific ontologies.

Importance of Entity-Relationship diagram in database


design

• Entity-Relationship Diagram views real world as entities. It introduced in 1976


by P.P.Chen and is known as ER Diagram, E R Model, etc.

The following states the importance of Entity-


Relationship diagram −

• Assist the Database Developer


The ER Diagram assists the design even before the construction of tables begins.

• Requirements Gathering
17
This helps the users to plan how to organize data.

• Documentation Tool
ER Diagrams can work as a documentation to make others understand the core of
the database.

• Logic of the database


It communicates the logical structure of the database to the users.

• Blueprint
An ER Diagram is considered as the blueprint of the database.

Conclusion

With the help of Entity-Relationship diagram we can create the required database
and perform queries. For example in case of Airline Reservation System we can
make queries like to find the schedule time of a flight, number of booked seats in a
flight, flight fares etc with the help of query language like SQL Relational Algebra,
Relational Calculus etc.

We can represent a database that conforms to an E-R database schema by a


collection of tables. For each entity set and for each relationship set in database,
there is a unique table to which we can assign the name of the corresponding
entity set and relationship set. Each table has multiple columns, each of which has
a unique name. Both the E-R model and the relational-database model are
abstract, logical representations of real-world enterprises.

18
Because the two models employ similar design principles, we can convert an E-R
design into a relational design. Converting a database representation from an E-R
diagram to a table format is the way we arrive at a relational-database design from
an E-R diagram.

Reference

www.google.com

Text Book

Introduction of Database Management

19

You might also like