You are on page 1of 3

Helpful for conceptualizing the Real World

Review
• Entity: a thing that exists
Entity-Relationship (ER) Model – e.g. person, automobile, department, employee
• Entity Set: a group of similar entities
(Peter P.-S. Chen) – e.g. all persons, all automobiles, all employees

• Relationship: association between entities


– e.g. a person is assigned to a department
CIS 671 • Relationship Set : set of similar relationships
Douglas S. Kerr
• Attribute: property of an entity or relationship
– e.g. person - name, address
• Domain: set of values allowed for an attribute
Entity-Relationship Model Review 1 Entity-Relationship Model Review 2

Example Complete Picture D#

Employees E#, ENAME, ADDRESS 1 Department


Departments D#, DNAME Is
E# N
Projects P#, PNAME In DNAME

Employee
Constraints (cardinality)
N
1. Employees may be assigned to only 1 department at a time.
2. Employees may be assigned to several projects at once,
ENAME ADDRESS Assigned P#
To M
each with an associated %time.
Project
Constraints (participation)
3. Employees must be assigned to a department. %TIME PNAME
4. Employees need not be assigned to any projects.
Entity-Relationship Model Review 3 Entity-Relationship Model Review 4

Example: Relationships and Attributes Example: Relationships and Attributes


1. N Is 1
Employee Department
In
N Is 1
Employee Department 3. Total
In
3. Employees must be assigned to a department.
1. Employees may be assigned to only 1 department at a time.
• Total: Each entity must be included at least once in the relationship.
2.
N M Project
N M Project Employee Assigned
Employee Assigned
To
To
4.Partial %TIME
%TIME
4. Employees need not be assigned to any projects.
2. Employees may be assigned to several projects at once, each with an associated %time.
• Partial: Each entity instance need not be included at least once in the relationship.

Entity-Relationship Model Review 5 Entity-Relationship Model Review 6

1
Entity-Relationship Enhancements: Attributes Entity-Relationship Enhancements: Attributes

1. Simple (atomic) vs. Composite Attributes 2. Single-valued vs. Multi-valued Attributes


– Simple LName – Multi-valued
Student Major
Employee E# Employee
FName

– Composite – Multi-valued as Entity


Major
LName
Employee Name
N Has M Major_Program
FName Student
Major

Entity-Relationship Model Review 7 Entity-Relationship Model Review 8

Entity-Relationship Enhancements: Attributes Entity-Relationship Enhancements: Entities


• Weak Entity Type, Identifying
3. Derived Attributes - Include in Department Relationship Type, Partial Key
the average salary of the employees in the • E.g. Represent all the dependents of each
department. employee given his or her name. No ID
number. Problem: Names are not unique
Employee Member Department across employees.
Of
1 N
Employee Dependents Dependent
Salary AvgSal Of

Name SSN Name


Entity-Relationship Model Review 9 Entity-Relationship Model Review 10

Cardinality and Participation:


Alternate Representation As Relations
• Original Notation
1 1 • Entities
Employee Manages Department
– Department(D#, DNAME)
– Employee(E#, ENAME, ADDRESS)
• Alternate Notation: (min, max) – Project(P#, PNAME)

(1,1)
• Relationships
(0,1)
Employee Manages Department – Is_In(E#, D#) 1:N
– Min represents participation (0 partial, >0 total). – Assigned_To(E#, P#, %TIME) N:M
– Max represents cardinality.
Entity-Relationship Model Review 11 Entity-Relationship Model Review 12

2
As Relations: Replacing Employee and Enhanced-ER (EER) Model
Is_In with Employee’
• Entities • Subclasses & Superclasses
– Department(D#, DNAME) – Specialization & Generalization
– Employee’(E#, ENAME, ADDRESS, D#) – Type Inheritance
– Project(P#, PNAME)
• Categories
• Relationships
– Assigned_To(E#, P#, %TIME) N:M

– [Is_In(E#, D#)]
Entity-Relationship Model Review 13 Entity-Relationship Model Review 14

Example: University Database Example: Meeting Locations


• Superclasses & Subclasses • Categories
d disjoint


• Generalization & Specialization total union


Street
• Inheritance Name*
o overlap Address
partial


EmpID Salary superclass subclass Building Organization


Name*
IsIn
SSN Employee Degree
Room Organization


Program
Number* Room
Person o
Grad Student Capacity
 

MeetingLocation MeetsAt
Name 
Place
Park
Student d 

Superclass instance Park EaseWest NorthSouth Date


Undergrad Student
must always exist. Major Name* Coordinates Coordinates
Dept Time*
Day*
Class
Entity-Relationship Model Review 15 Entity-Relationship Model Review 16

You might also like