SlideShare a Scribd company logo
Entity-Relationship
(E/R) Model
Dr P Sreenivasa Kumar
Professor
CS&E Dept I I T Madras
Prof P Sreenivasa Kumar
Department of CS&E, IITM
2
Entity-Relationship (E/R) Model
Widely used conceptual level data model
• proposed by Peter P Chen in 1970s
Data model to describe the database system at the requirements
collection stage
• high level description.
• easy to understand for the enterprise managers.
• rigorous enough to be used for system building.
Concepts available in the model
• entities and attributes of entities.
• relationships between entities.
• diagrammatic notation.
Prof P Sreenivasa Kumar
Department of CS&E, IITM
3
Entities
Entity - a thing (animate or inanimate) of independent
physical or conceptual existence and distinguishable.
In the University database context, an individual
student, faculty member, a class room, a course
are entities.
Entity Set or Entity Type-
Collection of entities all having the same properties.
Student entity set – collection of all student entities.
Course entity set – collection of all course entities.
Prof P Sreenivasa Kumar
Department of CS&E, IITM
4
Attributes
Each entity is described by a set of attributes/properties.
student entity
StudName – name of the student.
RollNumber – the roll number of the student.
Sex – the gender of the student etc.
All entities in an Entity set/type have the same set of attributes.
Chosen set of attributes – amount of detail in modeling.
Prof P Sreenivasa Kumar
Department of CS&E, IITM
5
Types of Attributes (1/2)
• Simple Attributes
having atomic or indivisible values.
example: Dept – a string
PhoneNumber – an eight digit number
• Composite Attributes
having several components in the value.
example: Qualification with components
(DegreeName, Year, UniversityName)
• Derived Attributes
Attribute value is dependent on some other attribute.
example: Age depends on DateOf Birth.
So age is a derived attribute.
Prof P Sreenivasa Kumar
Department of CS&E, IITM
6
Types of Attributes (2/2)
• Single-valued
having only one value rather than a set of values.
for instance, PlaceOfBirth – single string value.
• Multi-valued
having a set of values rather than a single value.
for instance, CoursesEnrolled attribute for student
EmailAddress attribute for student
PreviousDegree attribute for student.
• Attributes can be:
simple single-valued, simple multi-valued,
composite single-valued or composite multi-valued.
Prof P Sreenivasa Kumar
Department of CS&E, IITM
7
Diagrammatic Notation for Entities
entity - rectangle
attribute - ellipse connected to rectangle
multi-valued attribute - double ellipse
composite attribute - ellipse connected to ellipse
derived attribute - dashed ellipse
EmailAddress
AdmissionYear
Program
Student
RollNumber
StudName
Lname
Fname Mname
Sex
Age DateOfBirth
Prof P Sreenivasa Kumar
Department of CS&E, IITM
8
Domains of Attributes
Each attribute takes values from a set called its domain
For instance, studentAge – {17,18, …, 55}
HomeAddress – character strings of length 35
Domain of composite attributes –
cross product of domains of component attributes
Domain of multi-valued attributes –
set of subsets of values from the basic domain
Prof P Sreenivasa Kumar
Department of CS&E, IITM
9
Entity Sets and Key Attributes
• Key – an attribute or a collection of attributes whose value(s)
uniquely identify an entity in the entity set.
• For instance,
• RollNumber - Key for Student entity set
• EmpID - Key for Faculty entity set
• HostelName, RoomNo - Key for Student entity set
(assuming that each student gets to stay in a single room)
• A key for an entity set may have more than one attribute.
• An entity set may have more than one key.
• Keys can be determined only from the meaning of the
attributes in the entity type.
• Determined by the designers
Prof P Sreenivasa Kumar
Department of CS&E, IITM
10
Relationships
• When two or more entities are associated with each other,
we have an instance of a Relationship.
• E.g.: student Ramesh enrolls in Discrete Mathematics course
• Relationship enrolls has Student and Course as the
participating entity sets.
• Formally, enrolls ⊆ Student × Course
• (s,c) ∈ enrolls ⇔ Student ‘s’ has enrolled in Course ‘c’
• Tuples in enrolls – relationship instances
• enrolls is called a relationship Type/Set.
Prof P Sreenivasa Kumar
Department of CS&E, IITM
11
Degree of a relationship
• Degree : the number of participating entities.
• Degree 2: binary
• Degree 3: ternary
• Degree n: n-ary
• Binary relationships are very common and widely used.
Prof P Sreenivasa Kumar
Department of CS&E, IITM
12
Diagrammatic Notation for Relationships
Relationship – diamond shaped box
Rectangle of each participating entity is connected by a line to
this diamond. Name of the relationship is written in the box.
A
C
B
R
Prof P Sreenivasa Kumar
Department of CS&E, IITM
13
Binary Relationships and Cardinality Ratio
E1
E2
R
• The number of entities from E2 that an entity from E1 can
possibly be associated thru R (and vice-versa) determines
the cardinality ratio of R.
• Four possibilities are usually specified:
• one-to-one (1:1)
• one-to-many (1:N)
• many-to-one (N:1)
• many-to-many (M:N)
M N
Prof P Sreenivasa Kumar
Department of CS&E, IITM
14
Cardinality Ratios
• One-to-one: An E1 entity may be associated with at
most one E2 entity and similarly
an E2 entity may be associated with at
most one E1 entity.
• One-to-many: An E1 entity may be associated with
many E2 entities whereas an E2 entity may
be associated with at most one E1 entity.
• Many-to-one: … ( similar to above)
• Many-to-many: Many E1 entities may be associated with a
single E2 entity and a single E1 entity
may be associated with many E2 entities.
Prof P Sreenivasa Kumar
Department of CS&E, IITM
15
Cardinality Ratio – example (one-to-one)
Teaches
ResidesIn
Professor Course
CourseID NamePhoneName
Sex
Address
Name
RollNo
Address
Student
Hostel
Room
HostelName
RoomNo
1 1
1 1
Credits
Prof P Sreenivasa Kumar
Department of CS&E, IITM
16
Cardinality Ratio – example (many-to-one/one-to-many)
belongsTo
guides
Professor Department
Name Location
PhoneName
Sex
Address
Name
Sex
Address
Professor
Student
Name RoomNo
1 N
N 1
Phone
Address (one-to-many)
(many-to-one)
Prof P Sreenivasa Kumar
Department of CS&E, IITM
17
Cardinality Ratio – example (many-to-many)
Student Courseenrolls
Name RollNo
Address
Name
CourseId
Credits
ProfessorSex
Name Phone
Address
SponsoredProject
Name Sponser
Value Duration
Start
Date
End
Date
worksFor
M N
M N
Prof P Sreenivasa Kumar
Department of CS&E, IITM
18
Participation Constraints
• An entity set may participate in a relation either totally or
partially.
• Total participation: Every entity in the set is involved in
some association (or tuple) of the relationship.
• Partial participation: Not all entities in the set are involved
in association (or tuples) of the relationship.
Notation:
E1 E2R
total partial
Prof P Sreenivasa Kumar
Department of CS&E, IITM
19
Example of total/partial Participation
belongsTo
guides
Professor Department
Name Location
PhoneName
Sex
Address
Name
Sex
Address
Professor
Student
Name RoomNo
1 N
N 1
Phone
Address
one-to-many
(many-to-one)
Prof P Sreenivasa Kumar
Department of CS&E, IITM
20
Structural Constraints
• Cardinality Ratio and Participation Constraints are together
called Structural Constraints.
• They are called constraints as the data must satisfy them to be
consistent with the requirements.
• Min-Max notation: pair of numbers (m,n) placed on the line
connecting an entity to the relationship.
• m: the minimum number of times a particular entity must
appear in the relationship tuples at any point of time
• 0 – partial participation
• ≥ 1 – total participation
• n: similarly, the maximum number of times a particular entity
can appear in the relationship tuples at any point of time
Prof P Sreenivasa Kumar
Department of CS&E, IITM
21
Comparing the Notations
E1 E2R
E1 E2R
N 1
(1,1) (0,N)
is equivalent to
Prof P Sreenivasa Kumar
Department of CS&E, IITM
22
Attributes for Relationship Types
Relationship types can also have attributes.
properties of the association of entities.
Student Courseenrolls
Grade
M N
grade gives the letter grade (S,A,B, etc.) earned by
the student for a course.
neither an attribute of student nor that of course.
Prof P Sreenivasa Kumar
Department of CS&E, IITM
23
Attributes for Relationship Types – More Examples
belongsToProfessor Department
joinDate
N 1
SponsoredProjectProfessor worksFor
percentTime
M N
Prof P Sreenivasa Kumar
Department of CS&E, IITM
24
Recursive Relationships and Role Names
• Recursive relationship: An entity set relating to itself
gives rise to a recursive relationship
• E.g., the relationship prereqOf is an example of a recursive
relationship on the entity Course
• Role Names – used to specify the exact role in which the
entity participates in the relationships
• Essential in case of recursive relationships
• Can be optionally specified in non-recursive cases
Course
prereqOf
prerequisite
course
Role Names
Prof P Sreenivasa Kumar
Department of CS&E, IITM
25
Weak Entity Sets
Weak Entity Set: An entity set whose members owe their
existence to some entity in a strong entity set.
entities are not of independent existence.
each weak entity is associated with some entity of the
owner entity set through a special relationship.
weak entity set may not have a key attribute.
S
Owner entity
Identifying relationship
Always total
WR
Double wall
box
Prof P Sreenivasa Kumar
Department of CS&E, IITM
26
Weak Entity Sets - Example
Course Section
has
Section
Name
CourseID
Credits
SectionNo
Year
SemesterNo
RoomNo
ClassTimeProfessor
A popular course may have
several sections each taught
by a different professor and
having its own class room
and meeting times
Partial key:
Uniquely identifies a section
among the set of sections
of a particular course
Prof P Sreenivasa Kumar
Department of CS&E, IITM
27
Complete Example for E/R schema: Specifications (1/2)
In an educational institute, there are several departments and
students belong to one of them. Each department has a unique
department number, a name, a location, phone number and is
headed by a professor. Professors have a unique employee Id,
name, phone number.
We like to keep track of the following details regarding students:
name, unique roll number, sex, phone number, date of birth,
age and one or more email addresses. Students have a local
address consisting of the hostel name and the room number.
They also have home address consisting of house number,
street, city and PIN. It is assumed that all students reside in the
hostels.
Prof P Sreenivasa Kumar
Department of CS&E, IITM
28
Complete Example for E/R schema: Specifications (2/2)
A course taught in a semester of the year is called a section. There
can be several sections of the same course in a semester; these
are identified by the section number. Each section is taught by a
different professor and has its own timings and a room to meet.
Students enroll for several sections in a semester.
Each course has a name, number of credits and the department that
offers it. A course may have other courses as pre-requisites i.e,
courses to be completed before it can be enrolled in.
Professors also undertake research projects. These are sponsored
by funding agencies and have a specific start date, end date and
amount of money given. More than one professor can be
involved in a project. Also a professor may be simultaneously
working on several projects. A project has a unique projectId.
Prof P Sreenivasa Kumar
Department of CS&E, IITM
29
StudentName
RollNo
Address
Street
City
HNo
LocalAddress
HostelName
RoomNo
EmailId
Age
DateOfBirth
Entities - Student
PIN
Sex
Prof P Sreenivasa Kumar
Department of CS&E, IITM
30
Entities – Department and Course
Department
Name
Location
Phone
HOD
Course
CourseID
Credits
Name
DeptNo
Prof P Sreenivasa Kumar
Department of CS&E, IITM
31
Professor
Name
ProfID
PhoneNumber
Project Sponsor
Amount
EndDateStartDate
Section
ClassRoomSectionID
Entities – Professor, Project and Sections
Timing
ProjectId
Prof P Sreenivasa Kumar
Department of CS&E, IITM
32
E/R Diagram showing relationships
Student Department
Course Professor
works
On
Project
hasSection
Section
prerequisite
Of
teaches
enrolls works
For
belongs
To
N 1
N
N
N
N
N
N
M
M M
1
1
1
offers
1
N
Prof P Sreenivasa Kumar
Department of CS&E, IITM
33
Design Choices: Attribute versus Relationship
• Should offering department be an attribute of a course or
should we create a relationship between Course and Dept
entities called, say, offers ?
• Later approach is preferable when the necessary entity,
in this case the Department, already exists.
• Should class room be an attribute of Section or
should we create an entity called ClassRoom and
have a relationship, say, meetsIn,
connecting Section and ClassRoom?
• In this case, the option of making classRoom as an attribute
of Section is better as we do not want to give a lot of
importance to class room and make it a an entity.
Prof P Sreenivasa Kumar
Department of CS&E, IITM
34
Design Choices:
Weak entity versus composite multi-valued attributes
• Note that section could be a composite multi-valued attribute
of Course entity.
• However, if so, section can not participate in relationships,
such as, enrolls with Student entity.
• In general, if a thing, even though not of independent existence,
participates in other relationships on its own, it is best
captured as a weak entity.
• If the above is not the case, composite multi-valued
attribute may be enough.
Prof P Sreenivasa Kumar
Department of CS&E, IITM
35
Ternary Relationships
Relationship instance (c, p, j) indicates that
company c supplies a component p that is made use of by the project j
Company Component
Project
supply
serves uses
canSupply
Prof P Sreenivasa Kumar
Department of CS&E, IITM
36
Ternary Relationships
(c,p) in canSupply, (j,p) in uses, (c,j) in serves may not together imply (c,p,j) is
in supply. Whereas the other way round is of course true.
Company Component
Project
supply
serves uses
canSupply
The binary
relationships
together do not
convey the
same meaning
as supply
Ad

More Related Content

What's hot (20)

2 database system concepts and architecture
2 database system concepts and architecture2 database system concepts and architecture
2 database system concepts and architecture
Kumar
 
Entity Relationship Modelling
Entity Relationship ModellingEntity Relationship Modelling
Entity Relationship Modelling
Bhandari Nawaraj
 
Uml class-diagram
Uml class-diagramUml class-diagram
Uml class-diagram
ASHOK KUMAR PALAKI
 
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
Raj vardhan
 
DBMS Unit 2 ppt.ppt
DBMS Unit 2 ppt.pptDBMS Unit 2 ppt.ppt
DBMS Unit 2 ppt.ppt
PraveenS761061
 
Project proposal of school managment software
Project proposal of school managment softwareProject proposal of school managment software
Project proposal of school managment software
Proshanta Halder
 
Online placement cell ppt-TvC
Online placement cell ppt-TvCOnline placement cell ppt-TvC
Online placement cell ppt-TvC
TONO KURIAKOSE
 
Sequnce diagram for ONLINE EXAMINATION SYSTEM
Sequnce diagram for ONLINE EXAMINATION SYSTEMSequnce diagram for ONLINE EXAMINATION SYSTEM
Sequnce diagram for ONLINE EXAMINATION SYSTEM
COMSATS Institute of Information Technology
 
Student acadamic system Final report
Student acadamic system Final reportStudent acadamic system Final report
Student acadamic system Final report
Annu Venkata Nagarjuna
 
School Management System
School Management SystemSchool Management System
School Management System
Northeastern University
 
BI in the Cloud - Microsoft Power BI Overview and Demo
BI in the Cloud - Microsoft Power BI Overview and DemoBI in the Cloud - Microsoft Power BI Overview and Demo
BI in the Cloud - Microsoft Power BI Overview and Demo
Christopher Foot
 
Student management system project report c++
Student management system project report c++Student management system project report c++
Student management system project report c++
Student
 
Student Management System Presentation Slide
Student Management System Presentation  SlideStudent Management System Presentation  Slide
Student Management System Presentation Slide
Riajul islam Leon
 
Sql operator
Sql operatorSql operator
Sql operator
Pooja Dixit
 
online job portal system
online job portal systemonline job portal system
online job portal system
Krishna Ranjan
 
Student database management system
Student database management systemStudent database management system
Student database management system
Snehal Raut
 
Academic management system PPT
Academic management system PPTAcademic management system PPT
Academic management system PPT
Nagaraj Kandoor
 
Capability maturity model
Capability maturity modelCapability maturity model
Capability maturity model
Roy Antony Arnold G
 
Studentmanagementsystem
StudentmanagementsystemStudentmanagementsystem
Studentmanagementsystem
1amitgupta
 
A proposal for the automation of attendance system
A proposal for the automation of attendance systemA proposal for the automation of attendance system
A proposal for the automation of attendance system
Aj Aligonero
 
2 database system concepts and architecture
2 database system concepts and architecture2 database system concepts and architecture
2 database system concepts and architecture
Kumar
 
Entity Relationship Modelling
Entity Relationship ModellingEntity Relationship Modelling
Entity Relationship Modelling
Bhandari Nawaraj
 
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
Raj vardhan
 
Project proposal of school managment software
Project proposal of school managment softwareProject proposal of school managment software
Project proposal of school managment software
Proshanta Halder
 
Online placement cell ppt-TvC
Online placement cell ppt-TvCOnline placement cell ppt-TvC
Online placement cell ppt-TvC
TONO KURIAKOSE
 
BI in the Cloud - Microsoft Power BI Overview and Demo
BI in the Cloud - Microsoft Power BI Overview and DemoBI in the Cloud - Microsoft Power BI Overview and Demo
BI in the Cloud - Microsoft Power BI Overview and Demo
Christopher Foot
 
Student management system project report c++
Student management system project report c++Student management system project report c++
Student management system project report c++
Student
 
Student Management System Presentation Slide
Student Management System Presentation  SlideStudent Management System Presentation  Slide
Student Management System Presentation Slide
Riajul islam Leon
 
online job portal system
online job portal systemonline job portal system
online job portal system
Krishna Ranjan
 
Student database management system
Student database management systemStudent database management system
Student database management system
Snehal Raut
 
Academic management system PPT
Academic management system PPTAcademic management system PPT
Academic management system PPT
Nagaraj Kandoor
 
Studentmanagementsystem
StudentmanagementsystemStudentmanagementsystem
Studentmanagementsystem
1amitgupta
 
A proposal for the automation of attendance system
A proposal for the automation of attendance systemA proposal for the automation of attendance system
A proposal for the automation of attendance system
Aj Aligonero
 

Viewers also liked (20)

2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
koolkampus
 
Database management chapter 2 power point
Database management chapter 2 power pointDatabase management chapter 2 power point
Database management chapter 2 power point
mistydake
 
Chapter2
Chapter2Chapter2
Chapter2
Bahcesehir Uni
 
Er model
Er modelEr model
Er model
paddu123
 
Database management chapter 1 power point
Database management chapter 1 power pointDatabase management chapter 1 power point
Database management chapter 1 power point
mistydake
 
Biconnected components (13024116056)
Biconnected components (13024116056)Biconnected components (13024116056)
Biconnected components (13024116056)
Akshay soni
 
[Www.pkbulk.blogspot.com]dbms02
[Www.pkbulk.blogspot.com]dbms02[Www.pkbulk.blogspot.com]dbms02
[Www.pkbulk.blogspot.com]dbms02
AnusAhmad
 
ER Diagrams Simplified
ER Diagrams SimplifiedER Diagrams Simplified
ER Diagrams Simplified
Puneet Arora
 
Managing your tech career
Managing your tech careerManaging your tech career
Managing your tech career
Greg Jensen
 
6 relational schema_design
6 relational schema_design6 relational schema_design
6 relational schema_design
Utkarsh De
 
4 the sql_standard
4 the  sql_standard4 the  sql_standard
4 the sql_standard
Utkarsh De
 
Best Practices for Database Schema Design
Best Practices for Database Schema DesignBest Practices for Database Schema Design
Best Practices for Database Schema Design
Iron Speed
 
5 data storage_and_indexing
5 data storage_and_indexing5 data storage_and_indexing
5 data storage_and_indexing
Utkarsh De
 
Normalization
NormalizationNormalization
Normalization
Randy Riness @ South Puget Sound Community College
 
Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)
Vidyasagar Mundroy
 
Webinar: Build an Application Series - Session 2 - Getting Started
Webinar: Build an Application Series - Session 2 - Getting StartedWebinar: Build an Application Series - Session 2 - Getting Started
Webinar: Build an Application Series - Session 2 - Getting Started
MongoDB
 
MySQL Replication: Pros and Cons
MySQL Replication: Pros and ConsMySQL Replication: Pros and Cons
MySQL Replication: Pros and Cons
Rachel Li
 
Distributed Postgres
Distributed PostgresDistributed Postgres
Distributed Postgres
Stas Kelvich
 
Week3 Lecture Database Design
Week3 Lecture Database DesignWeek3 Lecture Database Design
Week3 Lecture Database Design
Kevin Element
 
Database Design
Database DesignDatabase Design
Database Design
learnt
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
koolkampus
 
Database management chapter 2 power point
Database management chapter 2 power pointDatabase management chapter 2 power point
Database management chapter 2 power point
mistydake
 
Database management chapter 1 power point
Database management chapter 1 power pointDatabase management chapter 1 power point
Database management chapter 1 power point
mistydake
 
Biconnected components (13024116056)
Biconnected components (13024116056)Biconnected components (13024116056)
Biconnected components (13024116056)
Akshay soni
 
[Www.pkbulk.blogspot.com]dbms02
[Www.pkbulk.blogspot.com]dbms02[Www.pkbulk.blogspot.com]dbms02
[Www.pkbulk.blogspot.com]dbms02
AnusAhmad
 
ER Diagrams Simplified
ER Diagrams SimplifiedER Diagrams Simplified
ER Diagrams Simplified
Puneet Arora
 
Managing your tech career
Managing your tech careerManaging your tech career
Managing your tech career
Greg Jensen
 
6 relational schema_design
6 relational schema_design6 relational schema_design
6 relational schema_design
Utkarsh De
 
4 the sql_standard
4 the  sql_standard4 the  sql_standard
4 the sql_standard
Utkarsh De
 
Best Practices for Database Schema Design
Best Practices for Database Schema DesignBest Practices for Database Schema Design
Best Practices for Database Schema Design
Iron Speed
 
5 data storage_and_indexing
5 data storage_and_indexing5 data storage_and_indexing
5 data storage_and_indexing
Utkarsh De
 
Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)
Vidyasagar Mundroy
 
Webinar: Build an Application Series - Session 2 - Getting Started
Webinar: Build an Application Series - Session 2 - Getting StartedWebinar: Build an Application Series - Session 2 - Getting Started
Webinar: Build an Application Series - Session 2 - Getting Started
MongoDB
 
MySQL Replication: Pros and Cons
MySQL Replication: Pros and ConsMySQL Replication: Pros and Cons
MySQL Replication: Pros and Cons
Rachel Li
 
Distributed Postgres
Distributed PostgresDistributed Postgres
Distributed Postgres
Stas Kelvich
 
Week3 Lecture Database Design
Week3 Lecture Database DesignWeek3 Lecture Database Design
Week3 Lecture Database Design
Kevin Element
 
Database Design
Database DesignDatabase Design
Database Design
learnt
 
Ad

Similar to 2 entity relationship_model (20)

ERModel1.pdf
ERModel1.pdfERModel1.pdf
ERModel1.pdf
MirHazarKhan1
 
Unit i b(er model)
Unit i b(er model)Unit i b(er model)
Unit i b(er model)
Rohit Rathi
 
3_Relational_Model.pdf
3_Relational_Model.pdf3_Relational_Model.pdf
3_Relational_Model.pdf
SrikanthS494888
 
RDBMS ERD
RDBMS ERDRDBMS ERD
RDBMS ERD
Sarmad Ali
 
Dbs4
Dbs4Dbs4
Dbs4
suneela mathe
 
Unit iv dbms
Unit   iv dbmsUnit   iv dbms
Unit iv dbms
Arnav Chowdhury
 
UNIT 1 INTRODUCTION TO DBMS, ER DIAGRAM, RELATION
UNIT 1 INTRODUCTION TO DBMS, ER DIAGRAM, RELATIONUNIT 1 INTRODUCTION TO DBMS, ER DIAGRAM, RELATION
UNIT 1 INTRODUCTION TO DBMS, ER DIAGRAM, RELATION
Bhakti Pawar
 
ER_model
ER_modelER_model
ER_model
Qasim Zahid
 
5e7ry754.pptx
5e7ry754.pptx5e7ry754.pptx
5e7ry754.pptx
qwert001
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship Model
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Database part3-
Database part3-Database part3-
Database part3-
Taymoor Nazmy
 
The Entity-Relationship Model(ER Diagram).pptx
The Entity-Relationship Model(ER Diagram).pptxThe Entity-Relationship Model(ER Diagram).pptx
The Entity-Relationship Model(ER Diagram).pptx
MANASINANDKISHORDEOR
 
Lecture 2 database management system.pdf
Lecture 2 database management system.pdfLecture 2 database management system.pdf
Lecture 2 database management system.pdf
samerelking3
 
Presentation on Entity Relationship Diagram.pptx
Presentation on Entity Relationship Diagram.pptxPresentation on Entity Relationship Diagram.pptx
Presentation on Entity Relationship Diagram.pptx
hamzamunawarkhan
 
Entity Relationship Model: ER concepts and Notations
Entity Relationship Model: ER concepts and NotationsEntity Relationship Model: ER concepts and Notations
Entity Relationship Model: ER concepts and Notations
halima9709
 
Data modeling
Data modelingData modeling
Data modeling
vidyapol01
 
3-db-er_3-db-er_3-db-er_3-db-er_3-db-er.pptx
3-db-er_3-db-er_3-db-er_3-db-er_3-db-er.pptx3-db-er_3-db-er_3-db-er_3-db-er_3-db-er.pptx
3-db-er_3-db-er_3-db-er_3-db-er_3-db-er.pptx
BUSHRASHAIKH804312
 
DBMS_Chapter3mklkjjkhgffgjtdjdffgfygyfty.pdf
DBMS_Chapter3mklkjjkhgffgjtdjdffgfygyfty.pdfDBMS_Chapter3mklkjjkhgffgjtdjdffgfygyfty.pdf
DBMS_Chapter3mklkjjkhgffgjtdjdffgfygyfty.pdf
deshna2thunga0
 
Database Design and Entity relationship Model.pptx
Database Design and Entity relationship Model.pptxDatabase Design and Entity relationship Model.pptx
Database Design and Entity relationship Model.pptx
yamuna67903
 
erdiagramspresentation-150826044953-lva1-app6891.pdf
erdiagramspresentation-150826044953-lva1-app6891.pdferdiagramspresentation-150826044953-lva1-app6891.pdf
erdiagramspresentation-150826044953-lva1-app6891.pdf
vinayakjadhav94
 
Unit i b(er model)
Unit i b(er model)Unit i b(er model)
Unit i b(er model)
Rohit Rathi
 
UNIT 1 INTRODUCTION TO DBMS, ER DIAGRAM, RELATION
UNIT 1 INTRODUCTION TO DBMS, ER DIAGRAM, RELATIONUNIT 1 INTRODUCTION TO DBMS, ER DIAGRAM, RELATION
UNIT 1 INTRODUCTION TO DBMS, ER DIAGRAM, RELATION
Bhakti Pawar
 
5e7ry754.pptx
5e7ry754.pptx5e7ry754.pptx
5e7ry754.pptx
qwert001
 
The Entity-Relationship Model(ER Diagram).pptx
The Entity-Relationship Model(ER Diagram).pptxThe Entity-Relationship Model(ER Diagram).pptx
The Entity-Relationship Model(ER Diagram).pptx
MANASINANDKISHORDEOR
 
Lecture 2 database management system.pdf
Lecture 2 database management system.pdfLecture 2 database management system.pdf
Lecture 2 database management system.pdf
samerelking3
 
Presentation on Entity Relationship Diagram.pptx
Presentation on Entity Relationship Diagram.pptxPresentation on Entity Relationship Diagram.pptx
Presentation on Entity Relationship Diagram.pptx
hamzamunawarkhan
 
Entity Relationship Model: ER concepts and Notations
Entity Relationship Model: ER concepts and NotationsEntity Relationship Model: ER concepts and Notations
Entity Relationship Model: ER concepts and Notations
halima9709
 
3-db-er_3-db-er_3-db-er_3-db-er_3-db-er.pptx
3-db-er_3-db-er_3-db-er_3-db-er_3-db-er.pptx3-db-er_3-db-er_3-db-er_3-db-er_3-db-er.pptx
3-db-er_3-db-er_3-db-er_3-db-er_3-db-er.pptx
BUSHRASHAIKH804312
 
DBMS_Chapter3mklkjjkhgffgjtdjdffgfygyfty.pdf
DBMS_Chapter3mklkjjkhgffgjtdjdffgfygyfty.pdfDBMS_Chapter3mklkjjkhgffgjtdjdffgfygyfty.pdf
DBMS_Chapter3mklkjjkhgffgjtdjdffgfygyfty.pdf
deshna2thunga0
 
Database Design and Entity relationship Model.pptx
Database Design and Entity relationship Model.pptxDatabase Design and Entity relationship Model.pptx
Database Design and Entity relationship Model.pptx
yamuna67903
 
erdiagramspresentation-150826044953-lva1-app6891.pdf
erdiagramspresentation-150826044953-lva1-app6891.pdferdiagramspresentation-150826044953-lva1-app6891.pdf
erdiagramspresentation-150826044953-lva1-app6891.pdf
vinayakjadhav94
 
Ad

Recently uploaded (20)

Process Parameter Optimization for Minimizing Springback in Cold Drawing Proc...
Process Parameter Optimization for Minimizing Springback in Cold Drawing Proc...Process Parameter Optimization for Minimizing Springback in Cold Drawing Proc...
Process Parameter Optimization for Minimizing Springback in Cold Drawing Proc...
Journal of Soft Computing in Civil Engineering
 
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design ThinkingDT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DhruvChotaliya2
 
ELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdfELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdf
Shiju Jacob
 
Data Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptxData Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptx
RushaliDeshmukh2
 
Fort night presentation new0903 pdf.pdf.
Fort night presentation new0903 pdf.pdf.Fort night presentation new0903 pdf.pdf.
Fort night presentation new0903 pdf.pdf.
anuragmk56
 
π0.5: a Vision-Language-Action Model with Open-World Generalization
π0.5: a Vision-Language-Action Model with Open-World Generalizationπ0.5: a Vision-Language-Action Model with Open-World Generalization
π0.5: a Vision-Language-Action Model with Open-World Generalization
NABLAS株式会社
 
new ppt artificial intelligence historyyy
new ppt artificial intelligence historyyynew ppt artificial intelligence historyyy
new ppt artificial intelligence historyyy
PianoPianist
 
Machine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptxMachine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptx
rajeswari89780
 
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
inmishra17121973
 
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptxExplainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
MahaveerVPandit
 
Metal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistryMetal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistry
mee23nu
 
some basics electrical and electronics knowledge
some basics electrical and electronics knowledgesome basics electrical and electronics knowledge
some basics electrical and electronics knowledge
nguyentrungdo88
 
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Journal of Soft Computing in Civil Engineering
 
Reagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptxReagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptx
AlejandroOdio
 
International Journal of Distributed and Parallel systems (IJDPS)
International Journal of Distributed and Parallel systems (IJDPS)International Journal of Distributed and Parallel systems (IJDPS)
International Journal of Distributed and Parallel systems (IJDPS)
samueljackson3773
 
railway wheels, descaling after reheating and before forging
railway wheels, descaling after reheating and before forgingrailway wheels, descaling after reheating and before forging
railway wheels, descaling after reheating and before forging
Javad Kadkhodapour
 
AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)
Vəhid Gəruslu
 
Degree_of_Automation.pdf for Instrumentation and industrial specialist
Degree_of_Automation.pdf for  Instrumentation  and industrial specialistDegree_of_Automation.pdf for  Instrumentation  and industrial specialist
Degree_of_Automation.pdf for Instrumentation and industrial specialist
shreyabhosale19
 
QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)
rccbatchplant
 
Compiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptxCompiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptx
RushaliDeshmukh2
 
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design ThinkingDT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DhruvChotaliya2
 
ELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdfELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdf
Shiju Jacob
 
Data Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptxData Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptx
RushaliDeshmukh2
 
Fort night presentation new0903 pdf.pdf.
Fort night presentation new0903 pdf.pdf.Fort night presentation new0903 pdf.pdf.
Fort night presentation new0903 pdf.pdf.
anuragmk56
 
π0.5: a Vision-Language-Action Model with Open-World Generalization
π0.5: a Vision-Language-Action Model with Open-World Generalizationπ0.5: a Vision-Language-Action Model with Open-World Generalization
π0.5: a Vision-Language-Action Model with Open-World Generalization
NABLAS株式会社
 
new ppt artificial intelligence historyyy
new ppt artificial intelligence historyyynew ppt artificial intelligence historyyy
new ppt artificial intelligence historyyy
PianoPianist
 
Machine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptxMachine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptx
rajeswari89780
 
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
inmishra17121973
 
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptxExplainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
MahaveerVPandit
 
Metal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistryMetal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistry
mee23nu
 
some basics electrical and electronics knowledge
some basics electrical and electronics knowledgesome basics electrical and electronics knowledge
some basics electrical and electronics knowledge
nguyentrungdo88
 
Reagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptxReagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptx
AlejandroOdio
 
International Journal of Distributed and Parallel systems (IJDPS)
International Journal of Distributed and Parallel systems (IJDPS)International Journal of Distributed and Parallel systems (IJDPS)
International Journal of Distributed and Parallel systems (IJDPS)
samueljackson3773
 
railway wheels, descaling after reheating and before forging
railway wheels, descaling after reheating and before forgingrailway wheels, descaling after reheating and before forging
railway wheels, descaling after reheating and before forging
Javad Kadkhodapour
 
AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)
Vəhid Gəruslu
 
Degree_of_Automation.pdf for Instrumentation and industrial specialist
Degree_of_Automation.pdf for  Instrumentation  and industrial specialistDegree_of_Automation.pdf for  Instrumentation  and industrial specialist
Degree_of_Automation.pdf for Instrumentation and industrial specialist
shreyabhosale19
 
QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)
rccbatchplant
 
Compiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptxCompiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptx
RushaliDeshmukh2
 

2 entity relationship_model

  • 1. Entity-Relationship (E/R) Model Dr P Sreenivasa Kumar Professor CS&E Dept I I T Madras
  • 2. Prof P Sreenivasa Kumar Department of CS&E, IITM 2 Entity-Relationship (E/R) Model Widely used conceptual level data model • proposed by Peter P Chen in 1970s Data model to describe the database system at the requirements collection stage • high level description. • easy to understand for the enterprise managers. • rigorous enough to be used for system building. Concepts available in the model • entities and attributes of entities. • relationships between entities. • diagrammatic notation.
  • 3. Prof P Sreenivasa Kumar Department of CS&E, IITM 3 Entities Entity - a thing (animate or inanimate) of independent physical or conceptual existence and distinguishable. In the University database context, an individual student, faculty member, a class room, a course are entities. Entity Set or Entity Type- Collection of entities all having the same properties. Student entity set – collection of all student entities. Course entity set – collection of all course entities.
  • 4. Prof P Sreenivasa Kumar Department of CS&E, IITM 4 Attributes Each entity is described by a set of attributes/properties. student entity StudName – name of the student. RollNumber – the roll number of the student. Sex – the gender of the student etc. All entities in an Entity set/type have the same set of attributes. Chosen set of attributes – amount of detail in modeling.
  • 5. Prof P Sreenivasa Kumar Department of CS&E, IITM 5 Types of Attributes (1/2) • Simple Attributes having atomic or indivisible values. example: Dept – a string PhoneNumber – an eight digit number • Composite Attributes having several components in the value. example: Qualification with components (DegreeName, Year, UniversityName) • Derived Attributes Attribute value is dependent on some other attribute. example: Age depends on DateOf Birth. So age is a derived attribute.
  • 6. Prof P Sreenivasa Kumar Department of CS&E, IITM 6 Types of Attributes (2/2) • Single-valued having only one value rather than a set of values. for instance, PlaceOfBirth – single string value. • Multi-valued having a set of values rather than a single value. for instance, CoursesEnrolled attribute for student EmailAddress attribute for student PreviousDegree attribute for student. • Attributes can be: simple single-valued, simple multi-valued, composite single-valued or composite multi-valued.
  • 7. Prof P Sreenivasa Kumar Department of CS&E, IITM 7 Diagrammatic Notation for Entities entity - rectangle attribute - ellipse connected to rectangle multi-valued attribute - double ellipse composite attribute - ellipse connected to ellipse derived attribute - dashed ellipse EmailAddress AdmissionYear Program Student RollNumber StudName Lname Fname Mname Sex Age DateOfBirth
  • 8. Prof P Sreenivasa Kumar Department of CS&E, IITM 8 Domains of Attributes Each attribute takes values from a set called its domain For instance, studentAge – {17,18, …, 55} HomeAddress – character strings of length 35 Domain of composite attributes – cross product of domains of component attributes Domain of multi-valued attributes – set of subsets of values from the basic domain
  • 9. Prof P Sreenivasa Kumar Department of CS&E, IITM 9 Entity Sets and Key Attributes • Key – an attribute or a collection of attributes whose value(s) uniquely identify an entity in the entity set. • For instance, • RollNumber - Key for Student entity set • EmpID - Key for Faculty entity set • HostelName, RoomNo - Key for Student entity set (assuming that each student gets to stay in a single room) • A key for an entity set may have more than one attribute. • An entity set may have more than one key. • Keys can be determined only from the meaning of the attributes in the entity type. • Determined by the designers
  • 10. Prof P Sreenivasa Kumar Department of CS&E, IITM 10 Relationships • When two or more entities are associated with each other, we have an instance of a Relationship. • E.g.: student Ramesh enrolls in Discrete Mathematics course • Relationship enrolls has Student and Course as the participating entity sets. • Formally, enrolls ⊆ Student × Course • (s,c) ∈ enrolls ⇔ Student ‘s’ has enrolled in Course ‘c’ • Tuples in enrolls – relationship instances • enrolls is called a relationship Type/Set.
  • 11. Prof P Sreenivasa Kumar Department of CS&E, IITM 11 Degree of a relationship • Degree : the number of participating entities. • Degree 2: binary • Degree 3: ternary • Degree n: n-ary • Binary relationships are very common and widely used.
  • 12. Prof P Sreenivasa Kumar Department of CS&E, IITM 12 Diagrammatic Notation for Relationships Relationship – diamond shaped box Rectangle of each participating entity is connected by a line to this diamond. Name of the relationship is written in the box. A C B R
  • 13. Prof P Sreenivasa Kumar Department of CS&E, IITM 13 Binary Relationships and Cardinality Ratio E1 E2 R • The number of entities from E2 that an entity from E1 can possibly be associated thru R (and vice-versa) determines the cardinality ratio of R. • Four possibilities are usually specified: • one-to-one (1:1) • one-to-many (1:N) • many-to-one (N:1) • many-to-many (M:N) M N
  • 14. Prof P Sreenivasa Kumar Department of CS&E, IITM 14 Cardinality Ratios • One-to-one: An E1 entity may be associated with at most one E2 entity and similarly an E2 entity may be associated with at most one E1 entity. • One-to-many: An E1 entity may be associated with many E2 entities whereas an E2 entity may be associated with at most one E1 entity. • Many-to-one: … ( similar to above) • Many-to-many: Many E1 entities may be associated with a single E2 entity and a single E1 entity may be associated with many E2 entities.
  • 15. Prof P Sreenivasa Kumar Department of CS&E, IITM 15 Cardinality Ratio – example (one-to-one) Teaches ResidesIn Professor Course CourseID NamePhoneName Sex Address Name RollNo Address Student Hostel Room HostelName RoomNo 1 1 1 1 Credits
  • 16. Prof P Sreenivasa Kumar Department of CS&E, IITM 16 Cardinality Ratio – example (many-to-one/one-to-many) belongsTo guides Professor Department Name Location PhoneName Sex Address Name Sex Address Professor Student Name RoomNo 1 N N 1 Phone Address (one-to-many) (many-to-one)
  • 17. Prof P Sreenivasa Kumar Department of CS&E, IITM 17 Cardinality Ratio – example (many-to-many) Student Courseenrolls Name RollNo Address Name CourseId Credits ProfessorSex Name Phone Address SponsoredProject Name Sponser Value Duration Start Date End Date worksFor M N M N
  • 18. Prof P Sreenivasa Kumar Department of CS&E, IITM 18 Participation Constraints • An entity set may participate in a relation either totally or partially. • Total participation: Every entity in the set is involved in some association (or tuple) of the relationship. • Partial participation: Not all entities in the set are involved in association (or tuples) of the relationship. Notation: E1 E2R total partial
  • 19. Prof P Sreenivasa Kumar Department of CS&E, IITM 19 Example of total/partial Participation belongsTo guides Professor Department Name Location PhoneName Sex Address Name Sex Address Professor Student Name RoomNo 1 N N 1 Phone Address one-to-many (many-to-one)
  • 20. Prof P Sreenivasa Kumar Department of CS&E, IITM 20 Structural Constraints • Cardinality Ratio and Participation Constraints are together called Structural Constraints. • They are called constraints as the data must satisfy them to be consistent with the requirements. • Min-Max notation: pair of numbers (m,n) placed on the line connecting an entity to the relationship. • m: the minimum number of times a particular entity must appear in the relationship tuples at any point of time • 0 – partial participation • ≥ 1 – total participation • n: similarly, the maximum number of times a particular entity can appear in the relationship tuples at any point of time
  • 21. Prof P Sreenivasa Kumar Department of CS&E, IITM 21 Comparing the Notations E1 E2R E1 E2R N 1 (1,1) (0,N) is equivalent to
  • 22. Prof P Sreenivasa Kumar Department of CS&E, IITM 22 Attributes for Relationship Types Relationship types can also have attributes. properties of the association of entities. Student Courseenrolls Grade M N grade gives the letter grade (S,A,B, etc.) earned by the student for a course. neither an attribute of student nor that of course.
  • 23. Prof P Sreenivasa Kumar Department of CS&E, IITM 23 Attributes for Relationship Types – More Examples belongsToProfessor Department joinDate N 1 SponsoredProjectProfessor worksFor percentTime M N
  • 24. Prof P Sreenivasa Kumar Department of CS&E, IITM 24 Recursive Relationships and Role Names • Recursive relationship: An entity set relating to itself gives rise to a recursive relationship • E.g., the relationship prereqOf is an example of a recursive relationship on the entity Course • Role Names – used to specify the exact role in which the entity participates in the relationships • Essential in case of recursive relationships • Can be optionally specified in non-recursive cases Course prereqOf prerequisite course Role Names
  • 25. Prof P Sreenivasa Kumar Department of CS&E, IITM 25 Weak Entity Sets Weak Entity Set: An entity set whose members owe their existence to some entity in a strong entity set. entities are not of independent existence. each weak entity is associated with some entity of the owner entity set through a special relationship. weak entity set may not have a key attribute. S Owner entity Identifying relationship Always total WR Double wall box
  • 26. Prof P Sreenivasa Kumar Department of CS&E, IITM 26 Weak Entity Sets - Example Course Section has Section Name CourseID Credits SectionNo Year SemesterNo RoomNo ClassTimeProfessor A popular course may have several sections each taught by a different professor and having its own class room and meeting times Partial key: Uniquely identifies a section among the set of sections of a particular course
  • 27. Prof P Sreenivasa Kumar Department of CS&E, IITM 27 Complete Example for E/R schema: Specifications (1/2) In an educational institute, there are several departments and students belong to one of them. Each department has a unique department number, a name, a location, phone number and is headed by a professor. Professors have a unique employee Id, name, phone number. We like to keep track of the following details regarding students: name, unique roll number, sex, phone number, date of birth, age and one or more email addresses. Students have a local address consisting of the hostel name and the room number. They also have home address consisting of house number, street, city and PIN. It is assumed that all students reside in the hostels.
  • 28. Prof P Sreenivasa Kumar Department of CS&E, IITM 28 Complete Example for E/R schema: Specifications (2/2) A course taught in a semester of the year is called a section. There can be several sections of the same course in a semester; these are identified by the section number. Each section is taught by a different professor and has its own timings and a room to meet. Students enroll for several sections in a semester. Each course has a name, number of credits and the department that offers it. A course may have other courses as pre-requisites i.e, courses to be completed before it can be enrolled in. Professors also undertake research projects. These are sponsored by funding agencies and have a specific start date, end date and amount of money given. More than one professor can be involved in a project. Also a professor may be simultaneously working on several projects. A project has a unique projectId.
  • 29. Prof P Sreenivasa Kumar Department of CS&E, IITM 29 StudentName RollNo Address Street City HNo LocalAddress HostelName RoomNo EmailId Age DateOfBirth Entities - Student PIN Sex
  • 30. Prof P Sreenivasa Kumar Department of CS&E, IITM 30 Entities – Department and Course Department Name Location Phone HOD Course CourseID Credits Name DeptNo
  • 31. Prof P Sreenivasa Kumar Department of CS&E, IITM 31 Professor Name ProfID PhoneNumber Project Sponsor Amount EndDateStartDate Section ClassRoomSectionID Entities – Professor, Project and Sections Timing ProjectId
  • 32. Prof P Sreenivasa Kumar Department of CS&E, IITM 32 E/R Diagram showing relationships Student Department Course Professor works On Project hasSection Section prerequisite Of teaches enrolls works For belongs To N 1 N N N N N N M M M 1 1 1 offers 1 N
  • 33. Prof P Sreenivasa Kumar Department of CS&E, IITM 33 Design Choices: Attribute versus Relationship • Should offering department be an attribute of a course or should we create a relationship between Course and Dept entities called, say, offers ? • Later approach is preferable when the necessary entity, in this case the Department, already exists. • Should class room be an attribute of Section or should we create an entity called ClassRoom and have a relationship, say, meetsIn, connecting Section and ClassRoom? • In this case, the option of making classRoom as an attribute of Section is better as we do not want to give a lot of importance to class room and make it a an entity.
  • 34. Prof P Sreenivasa Kumar Department of CS&E, IITM 34 Design Choices: Weak entity versus composite multi-valued attributes • Note that section could be a composite multi-valued attribute of Course entity. • However, if so, section can not participate in relationships, such as, enrolls with Student entity. • In general, if a thing, even though not of independent existence, participates in other relationships on its own, it is best captured as a weak entity. • If the above is not the case, composite multi-valued attribute may be enough.
  • 35. Prof P Sreenivasa Kumar Department of CS&E, IITM 35 Ternary Relationships Relationship instance (c, p, j) indicates that company c supplies a component p that is made use of by the project j Company Component Project supply serves uses canSupply
  • 36. Prof P Sreenivasa Kumar Department of CS&E, IITM 36 Ternary Relationships (c,p) in canSupply, (j,p) in uses, (c,j) in serves may not together imply (c,p,j) is in supply. Whereas the other way round is of course true. Company Component Project supply serves uses canSupply The binary relationships together do not convey the same meaning as supply