ER Diagram in DBMS

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

ER Diagram in DBMS

What is the ER Model? • Attributes


• The ER or (Entity Relational Model) is a highlevel • Relationships
conceptual data model diagram. Entity Relation model
is based on the notion of realworld entities and the WHAT IS ENTITY?
relationship between them. • A real-world thing either living or non-living that is
• ER modeling helps you to analyze data requirements easily recognizable and non-recognizable. It is anything
systematically to produce a welldesigned database. in the enterprise that is to be represented in our
database. It may be a physical thing or simply a fact
History of ER Models about the enterprise or an event that happens in the
ER diagrams are a visual tool which is helpful to real world.
represent the ER model. It was proposed by Peter Chen • An entity can be place, person, object, event or a
in 1971 to create a uniform convention which can be concept, which stores data in the database. The
used for relational database and network. He aimed to characteristics of entities are ‘must have an’ attribute,
use an ER model as a conceptual modeling approach. and a unique key.
Every entity is made up of some 'attributes' which
What is ER Diagrams? represent that entity.
Entity relationship diagram displays the relationships of Examples of entities:
entity set stored in a database. At first look, an ER • Person: Employee, Student, Patient
diagram looks very similar to the flowchart. However, • Place: Store, Building
ER Diagram includes many specialized symbols, and its • Object: Machine, product, and Car
meanings make this model unique. • Event: Sale, Registration, Renewal
Facts about ER Diagram Model: • Concept: Account, Course
• ER model allows you to draw Database Design
• It is easy to use graphical tool for modeling data Entity Set
• Widely used in Database Design Student
• It is a GUI representation of the logical structure of a • An entity set is a group of similar kind of entities. It
Database may contain entities with attribute sharing similar
• It helps you to identify the entities which exist in a values. Entities are represented by their properties,
system and the relationships between those entities. which also called attributes. All attributes have their
separate values. For example, a student entity may have
Why use ER Diagrams? a name, age, class, as attributes.
• Helps you to define terms related to entity
relationship modeling Example of Entities:
• Provide a preview of how all your tables should • A university may have some departments. All these
connect, what fields are going to be on each table departments employ various lecturers and offer several
• Helps to describe entities, attributes, relationships programs.
• ER diagrams are translatable into relational tables • Some courses make up each program. Students
which allows you to build databases quickly register in a particular program and enroll in various
• ER diagrams can be used by database designers as a courses. A lecturer from the specific department takes
blueprint for implementing data in specific software each course, and each lecturer teaches a various group
applications of students.
• The database designer gains a better understanding of
the information to be contained in the database with Relationship
the help of ERD diagram  Relationship is nothing but an association
• ERD is allowed to communicate with the logical among two or more entities.
structure of the database to users.  E.g., Tom works in the Chemistry department.
Entities take part in relationships. We can often
Components of the ER Diagram identify relationships with verbs or verb
This model is based on three basic concepts: phrases.
• Entities
Weak Entities
• A weak entity is a type of entity which doesn't have its
key attribute. It can be identified uniquely by
considering the primary key of another entity. For that,
weak entity sets need to have participation.

One-to-one:
• One entity from entity set X can be associated with at
most one entity of entity set Y and vice versa.
Example: One student can register for numerous
courses. However, all those courses have a single line
back to that one student.

Attributes One-to-many
• It is a single-valued property of either an entity-type • One entity from entity set X can be associated with
or a relationship-type. multiple entities of entity set Y, but an entity from
• For example, a lecture might have attributes: time, entity set Y can be associated with at least one entity.
date, duration, place, etc. For example, one class is consisting of multiple
• An attribute is represented by an Ellipse students.

Many to One
• More than one entity from entity set X can be
associated with at most one entity of entity set Y.
However, an entity from entity set Y may or may not be
associated with more than one entity from entity set X.
For example, many students belong to the same class.

Many to Many
• One entity from X can be associated with more than
one entity from Y and vice versa.
For example, Students as a group are associated with
multiple faculty members, and faculty members can be
associated with multiple students.

Cardinality ER- Diagram Notations


 Defines the numerical attributes of the ER- Diagram is a visual representation of data that
relationship between two entities or entity sets. describe how data is related to each other.
Different types of cardinal relationships are: • Rectangles: This symbol represent entity types
• One-to-One Relationships • Ellipses : Symbol represent attributes
• One-to-Many Relationships • Diamonds: This symbol represents relationship types
• Many to One Relationship • Lines: It links attributes to entity types and entity
• Many-to-Many Relationships types with other relationship types
• Primary key: attributes are underlined
• Double Ellipses: Represent multi-valued attributes
Best Practices for Developing Effective ER Diagrams
• Eliminate any redundant entities or relationships
• You need to make sure that all your entities and
relationships are properly labeled
• There may be various valid approaches to an ER
diagram. You need to make sure that the ER diagram
supports all the data you need to store
• You should assure that each entity only appears a
single time in the ER diagram
• Name every relationship, entity, and attribute are
represented on your diagram
Steps to Create an ERD • Never connect relationships to each other
• You should use colors to highlight important portions
Step 1) Entity Identification of the ER diagram.
We have three entities:
Student Summary
Course • The ER model is a high-level data model diagram
Professor • ER diagrams are a visual tool which is helpful to
represent the ER model
Step 2) Relationship Identification • Entity relationship diagram displays the relationships
We have the following two relationships of entity set stored in a database
• The student is assigned a course • ER diagrams help you to define terms related to entity
• Professor delivers a course relationship modeling
• ER model is based on three basic concepts: Entities,
Step 3) Cardinality Identification Attributes & Relationships
For the problem statement we know that, • An entity can be place, person, object, event or a
• A student can be assigned multiple courses concept, which stores data in the database
• A Professor can deliver only one course • Relationship is nothing but an association among two
or more entities
Step 4) Identify Attributes • A weak entity is a type of entity which doesn't have its
• files, forms, reports, data currently maintained by the key attribute
organization to identify attributes. • It is a single-valued property of either an entity-type
• conduct interviews with various stakeholders to or a relationship-type
identify entities • It helps you to defines the numerical attributes of the
• map them to the identified entities. Ensure an relationship between two entities or entity sets
attribute is to be paired with exactly one entity. • ER- Diagram is a visual representation of data that
• identify the primary Keys. If a unique key is not readily describe how data is related to each other
available, create one. • While Drawing ER diagram you need to make sure all
your entities and relationships are properly labeled.

You might also like