0% found this document useful (0 votes)
26 views10 pages

ER Diagram

An Entity Relationship Diagram (ER Diagram) visually represents the relationships between entities in a database, focusing on components such as entities, attributes, and relationships. It aids in conceptualizing database structures, reduces complexity, and allows for quicker database design. The document also explains various types of attributes and relationships, including one-to-one, one-to-many, and many-to-many relationships.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views10 pages

ER Diagram

An Entity Relationship Diagram (ER Diagram) visually represents the relationships between entities in a database, focusing on components such as entities, attributes, and relationships. It aids in conceptualizing database structures, reduces complexity, and allows for quicker database design. The document also explains various types of attributes and relationships, including one-to-one, one-to-many, and many-to-many relationships.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

ER Diagram (Entity Relationship Diagram)

An Entity Relationship Diagram (ER Diagram) pictorially explains the relationship between entities to be
stored in a database. Fundamentally, the ER Diagram is a structural design of the database. It acts as a
framework created with specialized symbols for the purpose of defining the relationship between the
database entities. ER diagram is created based on three principal components: entities, attributes, and
relationships.

The following diagram showcases two entities - Student and Course, and their relationship. The
relationship described between student and course is many-to-many, as a course can be opted by several
students, and a student can opt for more than one course. Student entity possesses attributes - Stu_Id,
Stu_Name & Stu_Age. The course entity has attributes such as Cou_ID & Cou_Name.

What is an ER Model?

An Entity-Relationship Model represents the structure of the database with the help of a diagram. ER
Modelling is a systematic process to design a database as it would require you to analyze all data
requirements before implementing your database.

Why Use ER Diagrams in DBMS?


• ER Diagram helps you conceptualize the database and lets you know which fields need to be
embedded for a particular entity
• ER Diagram gives a better understanding of the information to be stored in a database
• It reduces complexity and allows database designers to build databases quickly
• It helps to describe elements using Entity-Relationship models
• It allows users to get a preview of the logical structure of the database

Symbols Used in ER Diagrams


• Rectangles: This Entity Relationship Diagram symbol represents entity types
• Ellipses: This symbol represents attributes
• Diamonds: This symbol represents relationship types
• Lines: It links attributes to entity types and entity types with other relationship types
• Primary key: Here, it underlines the attributes
• Double Ellipses: Represents multi-valued attributes
Entities
• An entity can be either a living or non-living component.
• It showcases an entity as a rectangle in an ER diagram.
• For example, in a student study course, both the student and the course are entitie

Weak Entity

• An entity that makes reliance over another entity is called a weak entity
• You showcase the weak entity as a double rectangle in ER Diagram.
• In the example below, school is a strong entity because it has a primary key attribute - school
number. Unlike school, the classroom is a weak entity because it does not have any primary key
and the room number here acts only as a discriminator.
Attribute
• An attribute exhibits the properties of an entity.
• You can illustrate an attribute with an oval shape in an ER diagram.

Key Attribute

• Key attribute uniquely identifies an entity from an entity set.


• It underlines the text of a key attribute.
• For example: For a student entity, the roll number can uniquely identify a student
from a set of students.
Composite Attribute
• An attribute that is composed of several other attributes is known as a composite attribute.
• An oval showcases the composite attribute, and the composite attribute oval is further connected
with other ovals.

Multivalued Attribute
• Some attributes can possess over one value, those attributes are called multivalued attributes.
• The double oval shape is used to represent a multivalued attribute.

Derived Attribute
• An attribute that can be derived from other attributes of the entity is known as a derived attribute.
• In the ER diagram, the dashed oval represents the derived attribute.
Relationship

• The diamond shape showcases a relationship in the ER diagram.


• It depicts the relationship between two entities.
• In the example below, both the student and the
• course are entities, and study is the relationship between them.

One-to-One Relationship

• When a single element of an entity is associated with a single element of another entity, it is called
a one-to-one relationship.
• For example, a student has only one identification card and an identification card is given to one
person.

One-to-Many Relationship

• When a single element of an entity is associated with more than one element of another entity, it is
called a one-to-many relationship
• For example, a customer can place many orders, but an order cannot be placed by many
customers.
Many-to-One Relationship

• When more than one element of an entity is related to a single element of another entity, then it is
called a many-to-one relationship.
• For example, students have to opt for a single course, but a course can have many students.

Many-to-Many Relationship

• When more than one element of an entity is associated with more than one element of another
entity, this is called a many-to-many relationship.
• For example, you can assign an employee to many projects and a project can have many
employees.

STUDENT

id
Name
cgpa
Roles
• Entity sets of a relationship need not be distinct
• The labels “manager” and “worker” are called roles; they specify how employee entities interact
via the works-for relationship set.
• Roles are indicated in E-R diagrams by labeling the lines that connect diamonds to rectangles.
• Role labels are optional, and are used to clarify semantics of the relationship

Degree of a Relationship Set


• Refers to number of entity sets that participate in a relationship set.

• Relationship sets that involve two entity sets are binary (or degree two). Generally, most
relationship sets in a database system are binary.

• Relationship sets may involve more than two entity sets.

• Relationships between more than two entity sets are rare. Most relationships are binary.

You might also like