2.3 Conceptual ER Diagrams
2.3 Conceptual ER Diagrams
[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
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
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 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
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
ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram
Doctor Hospital
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
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
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 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
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
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
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
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
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
ABHISHEK KUMAR SINGH | DEPARTMENT OF MATHEMATICS & COMPUTING| IIT (ISM) DHANBAD
ER Diagram
Name Name List of Doctors
Speciality
M N
Doctor EMPANELMENT Hospital
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
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
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
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
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
(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)
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)
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)
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)
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
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
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