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

2.3 Conceptual ER Diagrams

This lecture discusses conceptual entity-relationship (ER) diagrams. It begins by reviewing the key concepts from the previous lecture, including entities, attributes, and relationships. The lecturer then explains the difference between logical and conceptual ER diagrams, noting that conceptual diagrams are used at a higher level of abstraction. As an example, a conceptual ER diagram is created step-by-step to model the relationships between doctors, hospitals, and patients. Key diagramming conventions are demonstrated, such as using rectangles for entities, ellipses for attributes, and double ellipses for multivalued attributes. The lecture continues building out the example diagram based on additional requirements.
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)
21 views50 pages

2.3 Conceptual ER Diagrams

This lecture discusses conceptual entity-relationship (ER) diagrams. It begins by reviewing the key concepts from the previous lecture, including entities, attributes, and relationships. The lecturer then explains the difference between logical and conceptual ER diagrams, noting that conceptual diagrams are used at a higher level of abstraction. As an example, a conceptual ER diagram is created step-by-step to model the relationships between doctors, hospitals, and patients. Key diagramming conventions are demonstrated, such as using rectangles for entities, ellipses for attributes, and double ellipses for multivalued attributes. The lecture continues building out the example diagram based on additional requirements.
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/ 50

Database Management Systems

[MCC511]
Winter, 2023-24

Lecture 2.3
Conceptual ER Diagrams
ABHISHEK KUMAR SINGH
ASSOCIATEPROFESSOR
DEPARTMENT OF MATHEMATICS & COMPUTING
IIT(ISM) DHANBAD
Last time …
We discussed some terms and their definitions
◦ For instance we talked about Entities and Entity Sets (real-world objects and a collection of similar objects)
◦ We saw the different types of attributes – single-valued, multivalued, atomic, composite, stored and derived
◦ We observed that a collection of relationships of same type (relationship set) can have attributes too

We had a brief encounter with an ER Diagram as well


◦ Today, let us make one from scratch

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
Types of ER Diagram
Remember the first few Diagrams that we saw during the previous Lecture?

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
I mean this …

Doctor Hospital
+Name +Name
+Speciality association +List of Doctors

An example of ER Diagram: Representing the relationships between Doctors and Hospitals

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
… and this !!

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
Types of ER Diagram
Remember the first few Diagrams that we saw during the previous Lecture?
The difference is the Level of Abstraction
◦ Yes, we are back to the same concept yet again !! :D

The former is used to model data at the Logical level …


◦ … e.g., when you are sure that the Relational Model will be used to store the data
◦ We may call it the “Logical” ER Diagram
◦ Yes, I know I told you ER Diagrams are actually at a slightly higher level than the logical level …
◦ … but Logical ER Diagrams are almost always a pre-cursor to Relational Models, hence this confusion

The latter is used to model data at a slightly higher level – much closer to the View Level
◦ We may call it the “Conceptual” ER Diagram as well; the ER Diagrams “as we knew them till now”

In this course though, when we say ER Diagram, we actually mean “Conceptual” ER Diagram

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
A sample ER Diagram
In this Lecture, we will go back to our Doctor-Hospital-Patient example …
◦ … and we will create an ER Diagram for it from scratch

We will take the liberty to add the Requirements in such a way …


◦ … that we can cover multiple variations in the ER Diagram …

However, we will not cover each and every ER Diagram aspect today …
◦ … since some of the modelling notations are rarely encountered, and I do not want you to ”over-learn” !!
◦ For example, we will not discuss modelling of Composite Attributes …
◦ … or the Keys and Weak Entity Sets – since we will cover them in the next Lecture !!

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
Processed Requirements
1. We have two types of real-world objects here – Doctor and Hospital

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram

Doctor Hospital

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram

Doctor Hospital

The first step is to draw the Entity Sets

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram

Doctor Hospital

The first step is to draw the Entity Sets


Entity Sets are shown as Rectangles

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
Processed Requirements
1. We have two types of real-world objects here – Doctor and Hospital
a. A Doctor has the properties – Name and Speciality

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram

Doctor Hospital

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram

Doctor Hospital

The next step is to add the respective Attributes to the Entity Sets

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram
Name

Speciality
Doctor Hospital

The next step is to add the respective Attributes to the Entity Sets
Attributes are shown as Ellipses connected to the respective Entity Set

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram
Name

Speciality
Doctor Hospital

The next step is to add the respective Attributes to the Entity Sets
Attributes are shown as Ellipses connected to the respective Entity Set, or Relationship Set, if applicable

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram
Name

Speciality
Doctor Hospital

The next step is to add the respective Attributes to the Entity Sets
Attributes are shown as Ellipses connected to the respective Entity Set, or Relationship Set, if applicable

* I agree that my poor drawing skills may have made them look like Ovals, but try to draw Ellipses, or near Ellipses !!

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
Processed Requirements
1. We have two types of real-world objects here – Doctor and Hospital
a. A Doctor has the properties – Name and Speciality
b. A Hospital has the properties – Name and List of Doctors (which can take multiple values)

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram
Name Name List of Doctors

Speciality
Doctor Hospital

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram
Name Name List of Doctors

Speciality
Doctor Hospital

Double Ellipses are used to show Multivalued Attributes

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
Processed Requirements
1. We have two types of real-world objects here – Doctor and Hospital
a. A Doctor has the properties – Name and Speciality
b. A Hospital has the properties – Name and List of Doctors (which can take multiple values)
c. We also have an attribute – Number of Doctors for each Hospital – which can be derived at the runtime

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram
Name Name List of Doctors

Speciality
Doctor Hospital

Number of Doctors

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram
Name Name List of Doctors

Speciality
Doctor Hospital

Dashed Ellipses are used to show Derived Attributes


Number of Doctors

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
Processed Requirements
1. We have two types of real-world objects here – Doctor and Hospital
a. A Doctor has the properties – Name and Speciality
b. A Hospital has the properties – Name and List of Doctors (which can take multiple values)
c. We also have an attribute – Number of Doctors for each Hospital – which can be derived at the runtime

2. A Doctor can be empanelled by a Hospital

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram
Name Name List of Doctors

Speciality
Doctor EMPANELMENT Hospital

Number of Doctors

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram
Name Name List of Doctors

Speciality
Doctor EMPANELMENT Hospital

Diamonds represent Relationship Sets


Number of Doctors

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
Detour – Showing Relationship Details
When we discussed relationships between two or more Entities, we did talk about Cardinality
◦ Although we just browsed over it, since you know the concepts already
◦ We will just revise them prior to showing them in an ER Diagram

Cardinality refers to the number of elements from each Entity Set involved in the relationship
We may divide them into three broad categories
◦ One-to-one – where each Entity Set contributes exactly one Entity to the relationship
◦ One-to-many – when multiple Entities of one Entity Set are related to one Entity from the other Set
◦ Many-to-many – when multiple Entities of one Entity Set are related to multiple Entities from the other Set

Also, when it is possible that some Entity in an Entity Set may not contribute to the relation at all …
◦ … we call such “participation” as Partial Participation, otherwise it is called Total Participation
◦ Example: A Hospital “must have” at least one Empanelled Doctor – it is Total Participation
◦ A Doctor “may not be” empanelled by any Hospital – an example of Partial Participation

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
Processed Requirements
1. We have two types of real-world objects here – Doctor and Hospital
a. A Doctor has the properties – Name and Speciality
b. A Hospital has the properties – Name and List of Doctors (which can take multiple values)
c. We also have an attribute – Number of Doctors for each Hospital – which can be derived at the runtime

2. A Doctor can be empanelled by a Hospital


a. Each Hospital has one or more empanelled Doctors
b. However, it is possible that a Doctor may not be empanelled at any Hospital

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram
Name Name List of Doctors

Speciality
Doctor EMPANELMENT Hospital

Number of Doctors

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram
Name Name List of Doctors

Speciality
Doctor EMPANELMENT Hospital

Total Participation in a relationship by an Entity Set is


Number of Doctors
represented by Double Connection Lines

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram
If you are unsure, leaving
Single Connection Lines
Name meaning Partial Name List of Doctors

Participation is fine

Speciality
Doctor EMPANELMENT Hospital

Total Participation in a relationship by an Entity Set is


Number of Doctors
represented by Double Connection Lines

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram
If you are unsure, leaving
Single Connection Lines
Name meaning Partial Name List of Doctors

Participation is fine

Speciality
Doctor EMPANELMENT Hospital

Total Participation in a relationship by an Entity Set is


Number of Doctors
represented by Double Connection Lines

Actually, participation is not something that is often shown in ER Diagrams anyway !!


What is often shown though, is Cardinality …
ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram
Name Name List of Doctors

Speciality
M N
Doctor EMPANELMENT Hospital

Number of Doctors

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram
Name Name List of Doctors

Speciality
M N
Doctor EMPANELMENT Hospital

Participation Cardinality can be shown by writing it


Number of Doctors
over the Connection Lines

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram
Name Name List of Doctors

Speciality
M N
Doctor EMPANELMENT Hospital

Participation Cardinality can be shown by writing it


Number of Doctors
over the Connection Lines

Typically, the most common symbols used are 1, M


and N to show 1:1, 1:N and M:N relationships

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
Processed Requirements
1. We have two types of real-world objects here – Doctor and Hospital
a. A Doctor has the properties – Name and Speciality
b. A Hospital has the properties – Name and List of Doctors (which can take multiple values)
c. We also have an attribute – Number of Doctors for each Hospital – which can be derived at the runtime

2. A Doctor can be empanelled by a Hospital


a. Each Hospital has one or more empanelled Doctors
b. However, it is possible that a Doctor may not be empanelled at any Hospital

3. A Hospital is owned by one or more Doctors

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
Processed Requirements
1. We have two types of real-world objects here – Doctor and Hospital
a. A Doctor has the properties – Name and Speciality
b. A Hospital has the properties – Name and List of Doctors (which can take multiple values)
c. We also have an attribute – Number of Doctors for each Hospital – which can be derived at the runtime

2. A Doctor can be empanelled by a Hospital


a. Each Hospital has one or more empanelled Doctors
b. However, it is possible that a Doctor may not be empanelled at any Hospital

3. A Hospital is owned by one or more Doctors

We are improvising now, so that we can see one more important scenario –
Multiple Relationships between the same Entity Sets !!

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
Processed Requirements
1. We have two types of real-world objects here – Doctor and Hospital
a. A Doctor has the properties – Name and Speciality
b. A Hospital has the properties – Name and List of Doctors (which can take multiple values)
c. We also have an attribute – Number of Doctors for each Hospital – which can be derived at the runtime

2. A Doctor can be empanelled by a Hospital


a. Each Hospital has one or more empanelled Doctors
b. However, it is possible that a Doctor may not be empanelled at any Hospital

3. A Hospital is owned by one or more Doctors


a. Not all Doctors are owners of Hospitals though

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram
Name Name List of Doctors

Speciality
M N
Doctor EMPANELMENT Hospital

Number of Doctors
OWNERSHIP

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram
Name Name List of Doctors

Speciality
M N
Doctor EMPANELMENT Hospital

It is ok to show “multiple diamonds”


Number of Doctors
“connecting the same rectangles”, to show OWNERSHIP
multiple relationships between the same
Entity Sets

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
Processed Requirements
1. We have two types of real-world objects here – Doctor and Hospital
a. A Doctor has the properties – Name and Speciality
b. A Hospital has the properties – Name and List of Doctors (which can take multiple values)
c. We also have an attribute – Number of Doctors for each Hospital – which can be derived at the runtime

2. A Doctor can be empanelled by a Hospital


a. Each Hospital has one or more empanelled Doctors
b. However, it is possible that a Doctor may not be empanelled at any Hospital

3. A Hospital is owned by one or more Doctors


a. Not all Doctors are owners of Hospitals though …
b. … but those who are, own a maximum of 1 Hospital only
c. A Hospital can have “at most” 3 owners

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram
Name Name List of Doctors

Speciality
(0, M) (1, N)
Doctor EMPANELMENT Hospital

(0, 1) (1, 3)

Number of Doctors
OWNERSHIP

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram
Name Name List of Doctors

Speciality
(0, M) (1, N)
Doctor EMPANELMENT Hospital

(0, 1) (1, 3)

This is an alternative notation to show


Number of Doctors
Participation Cardinality, which may be a OWNERSHIP
better option in some cases

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram
The pair (x,y) means that
every Entity from this Entity
Name Set must participate in at Name List of Doctors

least x relationships …

Speciality
(0, M) (1, N)
Doctor EMPANELMENT Hospital

(0, 1) (1, 3)

This is an alternative notation to show


Number of Doctors
Participation Cardinality, which may be a OWNERSHIP
better option in some cases

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram
… and any Entity in this
Entity Set cannot participate
Name in more than y instances of Name List of Doctors

the relationship !!

Speciality
(0, M) (1, N)
Doctor EMPANELMENT Hospital

(0, 1) (1, 3)

This is an alternative notation to show


Number of Doctors
Participation Cardinality, which may be a OWNERSHIP
better option in some cases

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram
Name Name List of Doctors

Speciality
(0, M) (1, N)
Doctor EMPANELMENT Hospital

(0, 1) (1, 3)

This is an alternative notation to show


Number of Doctors
Participation Cardinality, which may be a OWNERSHIP
better option in some cases

This means that “a Hospital can have between 1 to 3 Doctors as owners”,


and “a Doctor could own between 0 and 1 Hospitals”
ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
Summary of Important ER Notations (1/2)
Element ER Notation

Entity

Single-valued Attribute

Multivalued Attribute

Derived Attribute

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
Summary of Important ER Notations (2/2)
Element ER Notation

Relationship

Partial Participation

Total Participation

X X
Cardinality – Notation1 or

(min, max) (min, max)


Cardinality – Notation2 or

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
In the next Lecture …
We have covered most of the ER Modelling concepts... but a few remain
For instance, we have not yet talked about Keys
◦ They are a crucial part of any data model
◦ We will discuss them in the next Lecture

There are some Entity Sets which are called “Weak”


◦ We haven’t yet talked about it till now, but we will, in the next Lecture

Also, there are some more added notations to the ER Model, which we will zip through
◦ Personally, I do not feel they are used that often, but since it is discussed in the DBMS books …
◦ … and it is there in your syllabus :-/ …
◦ … we will discuss it briefly

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
Homework
Remember that we played this Lecture in the “God Mode” :P
◦ Basically, we churned out requirements that suited our agenda
◦ In the process, we actually side-lined the Patient entity
◦ Add it to the final version of the ER Diagram
◦ Check the material uploaded for the course on MIS

Get some clarity on the different types of ER Diagrams that people use
◦ Reading this article may help:
https://www.lucidchart.com/pages/ER-diagram-symbols-and-meaning
◦ You may not understand all the terms used, but try to grasp the Abstraction points

ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD

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