Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Digging Deeper
R &G - Chapters 2 & 3
cid
grade
Carnatic101
C
Reggae203
B
Topology112
A
History105
B
Students
sid name
login
age
53666Jones jones@cs
18
53688Smith smith@eecs 18
53650Smith smith@math 19
gpa
3.4
3.2
3.8
Aggregation
ssn
name
lot
Employees
Used to model a
relationship
Monitors
until
involving a
relationship set.
since
started_on
Allows us to treat
dname
pid
pbudget
did
budget
a relationship
set as an entity
Sponsors
Departments
Projects
set for purposes
of participation Aggregation vs. ternary
relationship?
in (other)
relationships. Monitors is a distinct relationship,
with a descriptive attribute.
Also, can say that each sponsorship
is monitored by at most one employee.
from
to
dname
ssn
lot
did
budget
Works_In2 does not
allow an employee to
Departments
Works_In2
Employees
work in a department
for two or more
periods.
(why not?)
Similar to the problem
of wanting to record
name
dname
ssn
lot
did
several addresses for an
budget
employee: we want to
Works_In3
Departments
Employees
record several values of
the descriptive
attributes for each
Duration
to
from
instance of this
relationship.
since
name
ssn
dbudget
lot
Employees
did
dname
budget
Departments
Manages2
name
ssn
lot
dname
did
Employees
budget
Departments
is_manager
apptnum
managed_by
since
Mgr_Appts
dbudget
Converting ER to Relational
name
lot
ssn
name
lot
123-22-3666 Attishoo
48
231-31-5368 Smiley
22
131-24-3650 Smethurst 35
Employees
123-22-3666 56
231-31-5368 51
3/3/93
2/2/92
since
name
ssn
dname
lot
Employees
did
Manages
budget
Departments
Translation to
relational model?
1-to-1
1-to Many
Many-to-1
Many-to-Many
name
ssn
dname
did
lot
Employees
Manages
budget
Departments
did
lot
Employees
Manages
Works_In
since
budget
Departments
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 n-ary 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.