IT244 Week 4
IT244 Week 4
IT244 Week 4
26/12/2021
College of Computing and Informatics
Data Science Pre-Master Program
IT244
Introduction to Database
IT244
Introduction to Database
Week 4
Entity–Relationship Model-1
Contents
1. Using High-Level Conceptual Data Models for Database Design
2. A Sample Database Application
3. Entity Types, Entity Sets, Attributes, and Keys
4. Relationship Types, Relationship Sets, Roles, and Structural
Constraints
5. Weak Entity Types
6. Refining the ER Design for the COMPANY Database
Weekly Learning Outcomes
Recommended Reading
Entity–Relationship Model-1:
https://courses.cs.vt.edu/cs4604/Spring21/pdfs/2-ermodel1.pdf
This Presentation is mainly dependent on the textbook: Fundamentals of Database Systems, Global Edition, 7th Edition (2017) by Ramez Elmasri & Shamkant Navathe
• Using High-Level Conceptual Data Models for Database
Design
Overview of the Database Design
Process
• There are two main activities (see Figure 7.1 in the
next slide):
– Database schema design
– Application programs design
• Focus will be on database schema design
– Given the database requirements, design the
conceptual schema for a database
• Application programs design focuses on the programs
and interfaces that access and update the database
(considered part of software engineering discipline)
The Database Design Process
• Relationship Type:
– Is the schema description of a relationship
– Identifies the relationship name and the participating
entity types
– Also identifies certain relationship constraints
• Relationship Set:
– The current set of relationship instances represented in the
database
– The current state of a relationship type
Relationship Set
• A set of associations (or relationship instances)
between individual entities from the participating
entity sets:
– Example: Figure 7.9 (next slide) shows a relationship
set for WORKS_FOR
– {r1, r2, r3, r4, r5, r6, r7, ...}
– Relationship instance r1=(e1, d1) means EMPLOYEE e1
WORKS_FOR DEPARTMENT d1
– Associates e1 with d1
Relationship Type
• Previous figure displayed the relationship set
• Each instance in the set relates individual participating
entities – one from each participating entity type
• In ER diagrams, we represent the relationship type as
follows:
– Diamond-shaped box is used to display a relationship type
– Connected to the participating entity types via straight lines
– Degree of a relationship type is the number of participating
entity types
Refining the COMPANY Initial Design
by Including Relationships
• By examining the requirements, attributes in the initial design
that refer to other entities are converted into relationships
(and removed from the entity types)
• Some of these relationship attributes (Figure 7.8, repeated on
next slide) are:
– The Department attribute of EMPLOYEE refers to the
DEPARTMENT entity that the employee WORKS_FOR
– The Manager attribute of DEPARTMENT refers to the EMPLOYEE
entity who MANAGES the DEPARTMENT
– The Supervisor attribute of EMPLOYEE refers to another
EMPLOYEE entity (this is called a recursive relationship)
– Several other similar attributes are converted into relationships –
can you identify those in next slide?
Refining the COMPANY Initial Design
by Including Relationships (2)
• Six relationship types are identified for the COMPANY
database schema (see Figure 7.2, repeated next slide)
• All are binary relationships (degree 2)
• Listed below with their participating entity types:
– WORKS_FOR (between EMPLOYEE, DEPARTMENT)
– MANAGES (also between EMPLOYEE, DEPARTMENT)
– CONTROLS (between DEPARTMENT, PROJECT)
– WORKS_ON (between EMPLOYEE, PROJECT)
– SUPERVISION (between EMPLOYEE (as subordinate), EMPLOYEE
(as supervisor))
– DEPENDENTS_OF (between EMPLOYEE, DEPENDENT)
Discussion on Relationship Types
• In the refined design, some attributes from the initial entity
types are refined into relationships:
– Manager of DEPARTMENT -> MANAGES
– Works_on of EMPLOYEE -> WORKS_ON
– Department of EMPLOYEE -> WORKS_FOR
– etc
• In general, more than one relationship type can exist between
the same participating entity types
– MANAGES and WORKS_FOR are distinct relationship types
between EMPLOYEE and DEPARTMENT
– Different meanings and different relationship instances.
Recursive Relationship Type
• A relationship type with the same entity type participating
twice in two distinct roles
• Example: the SUPERVISION relationship
• EMPLOYEE participates twice in two distinct roles:
– supervisor (or boss) role
– supervisee (or subordinate) role
– must distinguish the roles in a relationship instance
• Each relationship instance ri relates two distinct EMPLOYEE
entities (see Figure 7.11, next slide):
– One employee in supervisor role (labeled 1 in Fig. 7.11)
– One employee in supervisee role (labeled 2 in Fig. 7.11)
• Weak Entity Types
Weak Entity Types
• An entity type that does not have a key attribute on its own
• A weak entity must participate in an identifying relationship type with an
owner (or identifying) entity type
• Individual entities are identified by the combination of:
– A partial key of the weak entity type
– The particular entity they are related to in the identifying entity type
• Example (see Figure 7.2):
– A DEPENDENT entity is identified by the dependent’s first name, and
the specific EMPLOYEE with whom the dependent is related
– Name of DEPENDENT is the partial key
– DEPENDENT is a weak entity type
– EMPLOYEE is its identifying (owner) entity type via the identifying
relationship type DEPENDENT_OF
• Refining the ER Design for the COMPANY Database
Main Reference
1. Chapter 3: Using High-Level Conceptual Data Models for Database Design (3.1)
2. Chapter 3: A Sample Database Application (3.2)
3. Chapter 3: Entity Types, Entity Sets, Attributes, and Keys (3.3)
4. Chapter 3: Relationship Types, Relationship Sets, Roles, and Structural Constraints (3.4)
5. Chapter 3: Weak Entity Types (3.5)
6. Chapter 3: Refining the ER Design for the COMPANY Database (3.6)
(Fundamentals of Database Systems, Global Edition, 7th Edition (2017) by Ramez
Elmasri & Shamkant Navathe)
Additional References
https://courses.cs.vt.edu/cs4604/Spring21/pdfs/2-ermodel1.pdf
http://eds.a.ebscohost.com.sdl.idm.oclc.org/eds/pdfviewer/pdfviewer?vid=3&s
id=dc1635b3-88ab-4a84-814c-5908ea9c232c%40sdc-v-sessmgr01
This Presentation is mainly dependent on the textbook: Fundamentals of Database Systems, Global Edition, 7th Edition (2017) by Ramez Elmasri & Shamkant Navathe
Thank You