0% found this document useful (0 votes)
11 views

Er Model

Cs

Uploaded by

devileela921
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Er Model

Cs

Uploaded by

devileela921
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

ER Data Model


An Entity Relationship (ER) Diagram is a visual
representation of the relationships among
entities in a database. It uses rectangles for
entities, ellipses for attributes, diamonds for
relationships, and lines to connect entities and
attributes.

1
Components of an ER data model

Entities: Represented as rectangles, these are
the objects of interest in the database, such as
customers, products, or orders.
– Strong Entity
– Weak Entity

2
Types of entities
Strong Entity: A strong entity is an entity that has its attributes and a primary
key. It is independent of other entities and does not rely on any other entity
for its existence. Strong entities are depicted using rectangles in ER
diagrams.

3
Types of entities
Weak Entity: A weak entity is an entity that does not have a primary key
attribute of its own. It relies on the existence of a related strong entity, known
as its identifying or owner entity, to provide part of its primary key. Weak
entities are represented using double rectangles in ER diagrams.

4
Components of an ER data model
Attributes: Represented as ellipses, these are the
properties of entities, such as name, address, or price.
– Simple Attributes
– Key Attribute
– Composite Attributes
– Derived Attributes
– Multi-Valued Attributes

5
Types of attributes
Simple Attributes: A simple attribute is an attribute that cannot be further
subdivided into smaller components. It represents a single value for an
entity. It is represented by an oval.

6
Types of attributes
Key Attribute: The attribute which uniquely identifies each entity in the entity
set is called the key attribute. For example, Roll_No will be unique for each
student. It is represented by an oval with underlying lines.

7
Types of attributes
Composite Attributes: A composite attribute is an attribute that can be further
subdivided into smaller components, each representing a more granular
aspect of the attribute. It represents a collection of related simple attributes.
It is represented by an oval connected to other ovals.

8
Types of attributes
Derived Attributes: A derived attribute is an attribute whose value can be
calculated or derived from other attributes in the database. It is not stored
explicitly but can be computed using a formula or algorithm based on other
attributes. It is represented by a dashed oval.

9
Types of attributes
Multi-valued Attributes: A multi-valued attribute is an attribute that can have
multiple values for a single entity instance. It represents a set of values
rather than a single value. It is represented by a double oval.

10
The Complete Entity Type Student with its Attributes can be represented as:

11
Components of an ER data model

Relationships: These indicate associations between
entities, such as "has" or "belongs to". They are are depicted
using diamond-shaped symbols, with lines connecting the
participating entities.

12
Components of an ER data model

Degree of relationships: The degree of a relationship
indicates the number of entity types participating in the
relationship.
– Unary Relationship
– Binary Relationship
– Ternary Relationship
– n-ary Relationship: Involves more than three entity types.

13
Degree of relationships
Unary Relationship: Involves only one entity type.
eg. a person-spouse relationship, a manager-
employee relationship, etc

14
Degree of relationships
Binary Relationship: Involves two entity types.
eg. student-course enrolment, employee-
department assignment, author-book authorship, etc

15
Degree of relationship
Ternary Relationship: Involves three entity types.
eg. student-course-instructor allocation, product-
supplier-warehouse assignment, patient-doctor-
hospital assignment, etc

Assigned to Doctor
Patient

Hospital

16
Degree of relationship
n-ary Relationship: Involves more than three entity
types.
eg. student-course-instructor-assignment enrolment,
author-book-publisher-edition publication, customer-
order-product-store-payment, etc

17
Mapping Constraints

Cardinality: It specifies how many instances of one entity can be
associated with how many instances of another entity through a
particular relationship. Cardinality helps define the nature and
degree of the relationship between entities in a database
schema.
– 1-to-1
– 1-to-many
– many-to-1
– many-to-many

18
Cardinality
1-to-1: In a one-to-one relationship, each instance of one entity is
associated with exactly one instance of another entity, and vice versa.
eg. Each person has exactly one passport, and each passport
belongs to exactly one person, each student has exactly one student
ID card, and each student ID card belongs to exactly one student.

19
Cardinality
1-to-many: In a one-to-many relationship, each instance of one entity can be
associated with zero or more instances of another entity, but each instance of the
other entity can be associated with at most one instance of the first entity.
eg. Each department has many employees, but each employee belongs to only
one department, a customer can place many orders, but an order cannot be
placed by many customers, etc

20
Cardanality
Many-to-1: In a many-to-one relationship, many instances of one entity can be
associated with at most one instance of another entity, but each instance of the
other entity is associated with exactly one instance of the first entity.
eg. Many employees work in the same department, but each department has only
one manager, many students have to opt for a single course, but a course can
have many students, etc

21
Cardanality
many-to-many: In a many-to-many relationship, each instance of one entity can be
associated with zero or more instances of another entity, and each instance of the other
entity can be associated with zero or more instances of the first entity.
eg. Many customers can purchase multiple products, and each product can be purchased by
multiple customers, you can assign an employee to many projects and a project can have
many employees, etc.

22
23
24

You might also like