0% found this document useful (0 votes)
21 views9 pages

Notes Chapter 1.2 Lecture 1.2.5 (ER Diagram)

An Entity-Relationship Diagram (ER Diagram) is a visual representation of the structure of a database, depicting entities, attributes, and relationships among them. Key components include entities represented by rectangles, attributes shown as ovals, and relationships illustrated with diamonds, with various types of relationships such as one-to-one, one-to-many, and many-to-many. The ER model facilitates database design by allowing generalization and specialization of entities, aiding in the understanding and organization of data.
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
0% found this document useful (0 votes)
21 views9 pages

Notes Chapter 1.2 Lecture 1.2.5 (ER Diagram)

An Entity-Relationship Diagram (ER Diagram) is a visual representation of the structure of a database, depicting entities, attributes, and relationships among them. Key components include entities represented by rectangles, attributes shown as ovals, and relationships illustrated with diamonds, with various types of relationships such as one-to-one, one-to-many, and many-to-many. The ER model facilitates database design by allowing generalization and specialization of entities, aiding in the understanding and organization of data.
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/ 9

UNIT-1

CHAPTER 1.3

(ER Diagram)

Entity Relationship Diagram – ER Diagram in DBMS

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. Lets have a look at a simple
ER diagram to understand this concept.

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.

Fig: Sample ER Diagram


Here are the geometric shapes and their meaning in an E-R Diagram. We will discuss these
terms in detail in the next section(Components of a ER Diagram) of this guide so don’t worry
too much about these terms now, just go through them once.

 Rectangle: Represents Entity sets.


 Ellipses: Attributes
 Diamonds: Relationship Set
 Lines: They link attributes to Entity Sets and Entity sets to Relationship Set
 Double Ellipses: Multivalued Attributes
 Dashed Ellipses: Derived Attributes
 Double Rectangles: Weak Entity Sets
 Double Lines: Total participation of an entity in a relationship set

Components of a 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.
We will read more about relationships later, for now focus on entities.

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. There are four types of relationships:

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.
Total Participation of an Entity set

A Total participation of an entity set represents that each entity in entity set must have at least
one relationship in a relationship set. For example: In the below diagram each college must
have at-least one associated Student.

The ER Model has the power of expressing database entities in a conceptual hierarchical
manner. As the hierarchy goes up, it generalizes the view of entities, and as we go deep in the
hierarchy, it gives us the detail of every entity included.

Going up in this structure is called generalization, where entities are clubbed together to
represent a more generalized view. For example, a particular student named Mira can be
generalized along with all the students. The entity shall be a student, and further, the student
is a person. The reverse is called specialization where a person is a student, and that student is
Mira.

Generalization

As mentioned above, the process of generalizing entities, where the generalized entities
contain the properties of all the generalized entities, is called generalization. In
generalization, a number of entities are brought together into one generalized entity based on
their similar characteristics. For example, pigeon, house sparrow, crow and dove can all be
generalized as Birds.
Specialization

Specialization is the opposite of generalization. In specialization, a group of entities is


divided into sub-groups based on their characteristics. Take a group ‘Person’ for example. A
person has name, date of birth, gender, etc. These properties are common in all persons,
human beings. But in a company, persons can be identified as employee, employer, customer,
or vendor, based on what role they play in the company.

Similarly, in a school database, persons can be specialized as teacher, student, or a staff,


based on what role they play in school as entities.

Inheritance

We use all the above features of ER-Model in order to create classes of objects in object-
oriented programming. The details of entities are generally hidden from the user; this process
known as abstraction.

Inheritance is an important feature of Generalization and Specialization. It allows lower-level


entities to inherit the attributes of higher-level entities.
For example, the attributes of a Person class such as name, age, and gender can be inherited
by lower-level entities such as Student or Teacher.

OTHER REFRENCES

• ER Diagram: Entity Relationship Diagram Model | DBMS Example (guru99.com)

• ER Diagram Representation - Tutorialspoint

• Entity Relationship Diagram - ER Diagram in DBMS (beginnersbook.com)

SUGGESTED BOOK REFERENCES

1. Ramez Elmasri and Shamkant B. Navathe,“Fundamentals of Database System”, The


Benjamin / Cummings Publishing Co.

2. Korth and Silberschatz Abraham, “Database SystemConcepts”, McGraw Hall.

3. Pratt,”DBMS”, Cengage Learning.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy