Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
ER & Relational:
Digging Deeper
Enrolled
sid
53666
53666
53650
53666
Aggregation
ssn
name
lot
Students
cid
grade
Carnatic101
C
Reggae203
B
Topology112 A
History105
B
sid
53666
53688
53650
name
login
Jones jones@cs
Smith smith@eecs
Smith smith@math
age
18
18
19
gpa
3.4
3.2
3.8
Employees
Used to model a
relationship
Monitors
until
involving a
relationship set.
since
started_on
dname
Allows us to treat a
pid
pbudget
did
budget
relationship set
Sponsors
as an entity set
Departments
Projects
for purposes of
participation in Aggregation vs. ternary relationship?
Monitors is a distinct relationship, with a
(other)
descriptive attribute.
relationships. Also, can say that each sponsorship is
name
ssn
to
lot
Works_In2
Employees
ssn
name
dname
did
lot
Employees
from
budget
Departments
did
Works_In3
Duration
dname
budget
Departments
to
since
name
ssn
dbudget
lot
Employees
ssn
did
dname
budget
Departments
Manages2
name
lot
did
Employees
dname
budget
Departments
is_manager
apptnum
managed_by
since
Mgr_Appts
dbudget
Converting ER to Relational
ssn
name
lot
ssn
name
lot
123-22-3666 Attishoo
48
231-31-5368 Smiley
22
131-24-3650 Smethurst 35
Employees
123-22-3666 51
123-22-3666 56
231-31-5368 51
1/1/91
3/3/93
2/2/92
since
name
dname
ssn
lot
budget
did
Employees
Manages
Departments
Translation to
relational model?
1-to-1
1-to Many
Many-to-1
Many-to-Many
since
name
ssn
dname
did
lot
Employees
Manages
budget
Departments
name
ssn
dname
did
lot
Employees
Manages
budget
Departments
Works_In
since
lot
Employees
cost
Policy
pname
age
Dependents
Summary of ER (Cont.)
Several kinds of integrity constraints:
key constraints
participation constraints
Some foreign key constraints are also implicit in
the definition of a relationship set.
Many other constraints (notably, functional
dependencies) cannot be expressed.
Constraints play an important role in determining
the best database design for an enterprise.
Summary of ER (Cont.)
ER design is subjective. There are often many ways to
model a given scenario!
Analyzing alternatives can be tricky, especially for a large
enterprise. Common choices include:
Entity vs. attribute, entity vs. relationship, binary or nary relationship, whether or not to use ISA hierarchies,
aggregation.
Ensuring good database design: resulting relational
schema should be analyzed and refined further.
Functional Dependency information and normalization
techniques are especially useful.