Professional Documents
Culture Documents
Learning Outcomes
5. Database Applications
6. Database Architecture
File Processing System
File Processing System - Issues
• Data Redundancy
• Data Inconsistency
• Data Dependence
• Data Isolation
• Data Consistency
• Data Shareable
• Data independence
• Data Integration.
1. Hardware
2. Software
◦ a. DBMS
◦ b. Application Software
3. People
◦ a. Users
◦ b. Practitioners
4. Data
DBMS & Functions
Data Dictionary
w
a
r
e
h
o
u
s
e
s
a
n
d
Data Marts
6
.
D
i
s
t
r
i
b
u
t
e
d
D
a
t
a
b
a
s
e
s
Data warehouses
Data warehouses
• It is an information-analysis tool
that involves the automated
discovery of hidden patterns and
trends in historical business activity.
Lesson Title
Database Architecture
Mapping
1. External/conceptual mapping
2. Conceptual/internal mapping
Data Independence
Lesson Title
Introduction –Life cycle
Lesson Title
What is a requirement?
Types of requirements
◦ User requirements
◦ System requirements
◦ Software specifications – provide more (design) detail
User requirements
• All the student data should be stored for the future work
Lesson Title
System requirement –Database point of view
Lesson Title
ERD (Entity Relationship Diagram) and EERD
(Enhanced Entity Relationship Diagram
30
What is ERD?
Lesson Title
An entity
Lesson Title
Multivalued attribute Vs. Single Valued
Lesson Title
Stored versus derived attributes
Lesson Title
Identifier
Example:
◦ section1, section2, … become unique only if
you put them into a context, e.g.
csce4350
Weak Entity Set Notations
• Double rectangles for weak entity set
◦ 1 –1
◦ 1 – many
◦ Many-many
One-One and One-Many
Many-one and many-many
E-R Diagram: Chen Model
En
◦ re
pr
es
en
te
d
by
a
re
ct
an
gl
e
wi
th
its
na
m
e
in
ca
pit
al
le
tte
rs.
Rel
ati
ons
hip
s
◦ re
pr
es
en
te
d
by
an
ac
tiv
e
or
pa
ssi
ve
ve
rb
in
si
de
th
e
di
a
m
on
d
th
at
co
nn
ec
ts
th
e
rel
at
ed
en
titi
es
.
Co
nn
ecti
viti
es
◦ i.e
.,
ty
pe
s
of
rel
ati
on
sh
ip
◦ wr
itt
en
ne
xt
to
ea
ch
en
tit
y
bo
x.
E-R Diagram: Crow’s Foot Model
Entity
◦ repr
esen
ted
by a
rect
ang
e
with
its
nam
e in
cap
al
lette
rs.
Relati
onshi
ps
◦ repr
esen
ted
by
an
acti
e or
pass
ive
verb
that
con
nec
s th
rela
ed
enti
ties
Conn
ectivi
ties
◦ indi
ated
by
sym
bols
nex
to
enti
ties
◦ 2
verti
line
for 1
◦ “cro
foot
for M
Crow’s Foot Connections
Alternative Cardinality
Specification
Total Participation
• When we require all entities to participate in
the relationship (total participation), we use
double lines to specify
Every
at lea
Associative Entity
Lesson Title
Attribute on the relation
Lesson Title
Self Relationship (Unary
Relationship)
The labels “manger” and “worker” are called roles the self
relationship
Ternary Relationship
Can We Decompose a Ternary Relationship?
his/her father
and mother, is best replaced by two binary
relationships,
◦ Using two binary relationships allows
partial information (e.g. only mother
being know)
◦ But there are some relationships that are naturally non-binary
◦ E.g. works-on, why?
Converting Ternary to binary
Specialization
Completeness
must belong to
constraint
level entity sets
partial: an entity need not
belong to one of the lower-
level entity sets
Completeness
constraint
Lesson Title
A rule that specifies that an
instance of a super type may not
simultaneously be a member of
two (or more) subtypes.
Disjoint rule
Lesson Title
Overlap rule
simultaneously be a member of
Lesson Title
?
?
?
?
Logical design for relational databases
Lesson Title
Components of relational model
Data structure
Data manipulation
◦ Powerful
SQL
operations
for
retrieving
and
modifying
66
data
Data integrity
◦ Mechanisms for
manipulated data
Relation
• Relations (tables)
correspond with entity
types and with many-to-
many relationship types.
69
Schema for four relations (Pine Valley Furniture
Company)
Primary Key
Forei
gn
Key
(impl
emen
ts
1:N
relati
onshi
p
betw
een
custo
mer
and
order
)
C
o
m
b
i
n
e
d
,
t
h
e
s
e
a
r
e
c
o
m
p
o
s
i
t
e
p
r
i
m
a
r
y
k
e
y
(
u
n
i
q
u
e
l
y
i
d
e
n
t
i
f
i
e
s
t
h
e
o
r
d
e
r
l
i
n
e
)
…
i
n
d
i
v
i
d
u
a
l
l
y
t
h
e
y
a
r
e
f
o
r
e
i
g
n
k
e
y
s
(
i
m
p
l
e
m
e
n
t
M
:
N
r
e
l
a
t
i
o
n
s
h
i
p
b
e
t
w
e
e
n
o
r
d
e
r
a
n
d
p
r
o
d
u
c
t
)
Integrity Constraints
• Domain Constraints
Entity Integrity
• No primary key attribute
may be null. All primary
key fields MUST have data
71
Integrity Constraints
72
Referential integrity constraints (Pine Valley
Furniture)
◦ Simple
attributes:
E-R
attributes
map
directly
onto the
relation
component attributes
◦ Multivalued Attribute:
Becomes a separate
superior entity
74
Mapping a regular entity
(a)
(b)
78
Example of mapping a weak entity
a) Weak entity DEPENDENT
Example of mapping a weak entity (cont.)
b) Relations resulting from weak entity
NOTE: the domain constraint for the foreign key should NOT a
Foreign key
81
Example of mapping a 1:M
relationship
and orders
b) Mapping the relationship
Again, no nu
foreign key…
Foreign ke
82
82
Example of mapping an M:N
relationship
83
83
Example of mapping an M:N relationship (cont.)
b) Three resulting relations
Foreign key
Foreign ke
84
84
Example of mapping a binary 1:1 relationship
a) In charge relationship
(1:1)
85
85
Example of mapping a binary 1:1 relationship
b) Resulting relations
(cont.)
Foreign
key
goes in
the
relation
on the
optiona
l side,
matchi
ng the
primar
y key
on the
mandat
ory
side
Transforming EER Diagrams into
Relations (cont.)
Identifier Assigned
It is natural
and
familiar to
end-users
Default
identifier
may not be
unique
87
Example of mapping an associative entity
a) An associative entity
Example of mapping an associative entity (cont.)
b) Three resulting relations
89
89
Example of mapping an associative entity with
an identifier
a) SHIPMENT associative
entity
90
90
Example of mapping an
an identifier associative entity with
(cont.)
r
e
l
a
t
i
o
n
s
:
O
n
e
f
o
r
t
h
e
e
n
t
i
t
y
t
y
p
e
One for an associative relation in
which the primary key has two
attributes, both taken from the
primary key of the entity
92
Mapping a unary 1:N relationship
Mapping a unary M:N relationship
94
Transforming EER Diagrams
into Relations (cont.)
Ma
ppi
ng
Ter
nar
y
(an
d
n-
ary
)
Rel
ati
on
shi
ps
One relation for each entity and
one for the associative entity
Associative entity has foreign keys
to each entity in the relationship
95
Mapping a ternary relationship
a) PATIENT
TREATMENT
Ternary relationship
with associative
entity
Mapping a ternary relationship (cont.)
98
Supertype/subtype relationships
Mapping supertype/subtype relationships
to relations
Normalization
Lesson Title
Data Normalization
102
Well-Structured Relations
A relation that contains minimal
data redundancy and allows
users to insert, delete, and
update rows without causing
data inconsistencies
I
n
s
e
r
t
i
o
n
–
c
a
n
’
t
e
n
t
e
r
n
e
w
e
m
p
l
o
y
e
e
w
i
t
h
o
u
t
h
a
v
i
n
g
t
h
e
e
m
p
l
o
y
e
e
t
a
k
e
c
o
u
r
s
e
D
e
l
e
t
i
o
n
–
i
f
w
e
r
e
m
o
v
e
e
m
p
l
o
y
e
e
1
4
0
,
w
e
l
o
s
e
i
n
f
o
r
m
a
t
i
o
n
a
b
o
u
t
t
h
e
e
x
i
s
t
e
n
c
e
o
f
T
a
x
A
c
c
c
o
u
r
s
e
M
o
d
i
f
i
c
a
t
i
o
n
–
g
i
v
i
n
g
s
a
l
a
r
y
i
n
c
r
e
a
s
e
t
o
e
m
p
l
o
y
e
e
1
0
0
f
o
r
c
e
s
u
s
t
o
u
p
d
a
t
e
m
u
l
t
i
p
l
e
r
e
c
o
r
d
s
Steps in normalization
Functional Dependencies and
Keys
106
First Normal Form
N
o
m
u
l
t
i
v
a
l
u
e
d
a
t
t
r
i
b
u
t
e
s
E
v
e
r
y
a
t
t
r
i
b
u
t
e
v
a
l
u
e
i
s
a
t
o
m
i
c
st
Table with multivalued attributes, not in 1
normal form
Table with no multivalued
attributes and unique rows,
st
in 1 normal form
Second Normal Form
110
Functional dependency diagram for INVOICE
OrderID
OrderDate,
CustomerID,
CustomerName,
CustomerAddress
CustomerID
CustomerName,
CustomerAddress
ProductID ProductDescription,
ProductFinish,
ProductStandardPrice OrderID,
ProductID OrderQuantity
nd
Therefore, NOT in 2 Normal Form
Removing partial dependencies
P
a
rt
ia
l
d
e
p
e
n
d
e
n
ci
e
s
a
r
e
r
e
m
o
v
e
d,
b
u
t
t
h
e
r
e
a
r
e
st
il
l
tr
a
n
si
ti
v
e
d
e
p
e
n
d
e
n
ci
e
s
112
Third Normal Form
113
Removing partial dependencies
View Integration–Combining
entities from multiple ER
models into common relations