nhập môn cơ sở dữ liệu - phần 5 - Pdf 12

Biên soạn : ThS.Phan Võ Minh Thắng
1
Cơ sở Dữ liệu : Chuẩn hóa
Nh
Nh


p môn Cơ s
p môn Cơ s


D
D


li
li


u
u
Ph
Ph


n 5
n 5


Chu
Chu

a l
à
à
g
g
ì
ì
, vai trò c
, vai trò c


a n
a n
ó
ó
trong vi
trong vi


c
c
thi
thi
ế
ế
t k
t k
ế
ế
CSDL

á
ch chuy
ch chuy


n t
n t


d
d


ng chu
ng chu


n th
n th


p lên d
p lên d


ng
ng
chu
chu


ó
ó
a
a
v
v
à
à
vi
vi


c
c


h
h
ì
ì
nh
nh
E
E
-
-
R
R
đư
đư

đ
đ


th
th


c
c
hi
hi


n
n
t
t


t
t
vi
vi


c
c
thi
thi

ng
ng
h
h


p
p
yêu
yêu
c
c


u
u
ph
ph


i
i
de
de
-
-
normalization
normalization
đ
đ

u
u
qu
qu


Biên soạn : ThS.Phan Võ Minh Thắng
4
Cơ sở Dữ liệu : Chuẩnhóa
C
C
á
á
c
c
b
b


ng
ng
trong
trong
CSDL
CSDL
v
v
à
à
s

à
nh
nh
ph
ph


n
n


s
s


trong
trong
thi
thi
ế
ế
t
t
k
k
ế
ế
CSDL
CSDL


quan
tâm
tâm
h
h
à
à
ng
ng
đ
đ


u
u


C
C
ó
ó
hai
hai
trư
trư


ng
ng
h

n
t
t


i
i
c
c
á
á
c
c
b
b


ng
ng
c
c
ó
ó
c
c


u
u
tr


p
p




Hi
Hi


u
u
ch
ch


nh
nh
CSDL
CSDL
s
s


n
n
c
c
ó

ng
không
không
t
t


t
t


Chu
Chu


n
n
h
h
ó
ó
a
a
c
c
ó
ó
th
th



ng
ng
c
c
ó
ó
c
c


u
u
tr
tr
ú
ú
c
c
không
không
t
t


t
t
v
v
à

c
ó
ó
c
c


u
u
tr
tr
ú
ú
c
c
t
t


t
t
hơn
hơn
Biên soạn : ThS.Phan Võ Minh Thắng
5
Cơ sở Dữ liệu : Chuẩnhóa
C
C
á
á

a
a


Chu
Chu


n
n
h
h
ó
ó
a
a
l
l
à
à
qu
qu
á
á
tr
tr
ì
ì
nh
nh

c
c
th
th


c
c
th
th




Gi
Gi


m
m


th
th


a
a
d
d

á
á
c
c
th
th


c
c
th
th




Gi
Gi
ú
ú
p
p
lo
lo


i
i
b
b

a
a
đư
đư


c
c
ki
ki


m
m
so
so
á
á
t
t
đ
đ


liên
liên
k
k
ế
ế

chi
chi
ph
ph
í
í
x
x




hơn
hơn


Tr
Tr


i
i
qua
qua
m
m


t
t

d
d


ng
ng
chu
chu


n
n
Biên soạn : ThS.Phan Võ Minh Thắng
6
Cơ sở Dữ liệu : Chuẩnhóa
Database Tables and
Database Tables and
Normalization
Normalization


C
C
á
á
c
c
giai
giai
đo

-
Second normal form
Second normal form


3NF
3NF
-
-
Third normal form
Third normal form


4NF
4NF
-
-
Fourth normal form
Fourth normal form
Better in
dependency
Worse in
performance
(I/O)
Business
Bioinformatics
Statistical data
Biên soạn : ThS.Phan Võ Minh Thắng
7
Cơ sở Dữ liệu : Chuẩnhóa



ng
ng


Building projects
Building projects


Project number
Project number


Project name
Project name


Employees assigned
Employees assigned






Employee
Employee



qu


quan
quan
s
s
á
á
t
t
t
t


h
h
ì
ì
nh
nh
4.1
4.1


PRO_NUM intended to be primary key, but
PRO_NUM intended to be primary key, but
it contains null values.
it contains null values.


ì
ì
nh
nh
4.1
4.1


Table displays data redundancies which
Table displays data redundancies which
yield the following anomalies
yield the following anomalies


Update
Update


Modifying JOB_CLASS
Modifying JOB_CLASS


Insertion
Insertion


New employee must be assigned project (phantom
New employee must be assigned project (phantom
project)
project)

Repeating groups must be eliminated


Proper primary key developed
Proper primary key developed


Uniquely identifies attribute values (rows)
Uniquely identifies attribute values (rows)


Combination of PROJ_NUM and EMP_NUM
Combination of PROJ_NUM and EMP_NUM
Biên soạn : ThS.Phan Võ Minh Thắng
15
Cơ sở Dữ liệu : Chuẩnhóa
Conversion to 1NF
Conversion to 1NF


Repeating groups must be eliminated
Repeating groups must be eliminated


Dependencies can be identified
Dependencies can be identified


Desirable dependencies based on primary key
Desirable dependencies based on primary key

Composite primary key
Biên soạn : ThS.Phan Võ Minh Thắng
17
Cơ sở Dữ liệu : Chuẩnhóa
PROJ_NUM,EMP_NUM Æ PROJ_NAME, EMP_NAME,
JOB_CLASS,CHG_HOUR, HOURS
PROJ_NUM Æ PROJ_NAME
DESIRED DEPENDENCIES
EMP_NUM Æ EMP_NAME, JOB_CLASS, CHG_HOUR
PARTIAL DEPENDENCIES
JOB_CLASS -> CHG_HOUR
TRANSITIVE DEPENDENCIES
Biên soạn : ThS.Phan Võ Minh Thắng
18
Cơ sở Dữ liệu : Chuẩnhóa
1NF Summarized
1NF Summarized


All key attributes defined
All key attributes defined


No repeating groups in table
No repeating groups in table


All attributes dependent on
All attributes dependent on
primary key

20
Cơ sở Dữ liệu : Chuẩnhóa
2NF Conversion Results
2NF Conversion Results
Figure 4.5
Biên soạn : ThS.Phan Võ Minh Thắng
21
Cơ sở Dữ liệu : Chuẩnhóa
2NF Summarized
2NF Summarized


In 1NF
In 1NF


Includes no partial dependencies
Includes no partial dependencies


No attribute dependent on a portion of primary
No attribute dependent on a portion of primary
key
key


Still possible to exhibit transitive
Still possible to exhibit transitive
dependency
dependency

3NF Summarized
3NF Summarized


In 2NF
In 2NF


Contains no transitive
Contains no transitive
dependencies
dependencies
Biên soạn : ThS.Phan Võ Minh Thắng
24
Cơ sở Dữ liệu : Chuẩnhóa
Additional DB Enhancements
Additional DB Enhancements
Figure 4.6
Biên soạn : ThS.Phan Võ Minh Thắng
25
Cơ sở Dữ liệu : Chuẩnhóa


Nhờ tải bản gốc

Tài liệu, ebook tham khảo khác

Music ♫

Copyright: Tài liệu đại học © DMCA.com Protection Status