US - OOAD - 06 - Normal Form
US - OOAD - 06 - Normal Form
3NF
BCNF
Normalization
We consider a relation in BCNF to be fully normalized.
EmpEmail
EmpNum EmpFname
EmpLname
1. Reflexivity: If Y ⊆ X, then X → Y
2. Augmentation: If X → Y , then XZ → Y Z
EmpNum → EmpEmail
DeptNum → DeptName
i A → A ( by reflexivity rule )
ii A → AB ( by (i) and 1 )
iii A → ABC ( by (ii), 2, and transitivity rule )
iv A → ABCD ( by (iii), and 3 )
Therefore, A+M = {ABCD}.
Cover
A set of functional dependencies F covers another set of functional
dependencies G, if every functional dependency in G can be inferred
from F . More formally, F covers G if G+ ⊆ F+.
2nd Step
– A‐>A, B‐>B: can be removed as trivial
– A‐>C: can’t be removed, as there is no other LHS with A
– B‐>A: can’t be removed, because for J=H‐{B‐>A} is B+=BC
– B‐>C: can be removed, because for J=H‐{B‐>C} is B+=ABC
– D‐>A: can be removed, because for J=H‐{D‐>A} is D+=DBAC
– D‐>B: can’t be removed, because for J=H‐{D‐>B} is D+=DC
– D‐>C: can be removed, because for J=H‐{D‐>C} is D+=DBAC
Step outcome => H = {A‐>C, B‐>A, D‐>B}
3rd Step
– H doesn’t change as all LHS in H are single attributes
4th Step
– H doesn’t change
Minimal Cover: M = H = {A‐>C, B‐>A, D‐>B}
Normal Forms
All attributes depend on the key, the whole key and
nothing but the key.
Repeating group:
Orders(OrderNumber, OrderDate, {PartNumber,
NumberOrdered})
[12491 | 9/02/2001 | (BT04, 1), (BZ66, 1)]
First Normal Form
The following in not in 1NF
InvNum InvDate
EmployeeDept
ename ssn bdate address dnumber dname
Third Normal Form
• A relation is in 3NF if the relation is in 1NF and all
determinants of non-key attributes are candidate
keys. That is, for any functional dependency:
X → Y,
where Y is a non-key attribute (or a set of non-key
attributes), X is a candidate key.
student_no instr_no
course_no instr_no
Functional Dependencies:
(supplier_no, part_no) → quantity
(supplier_no) → status
(supplier_no) → city
city → status (Supplier's status is determined by location)
Exercise #5
SUPPLIER_PART (supplier_no, supplier_name, part_no,
quantity)
Functional Dependencies:
We assume that supplier_name's are always unique to
each supplier. Thus we have two candidate keys:
(supplier_no, part_no) and (supplier_name, part_no)