Phartheben
Selvam (6186038)
CSCI235: Database
Task 1
Q1
R1 = (A, B, C, D, E, F, G, H)
FD1: A,B,C,D → E,H
FD2: E→F
FD3: C, D → G
Minimal Key:
FD1: A,B,C,D → E,H
(ABCD)+ = ABCDEHFG
FD 1NF 2NF
3NF
BCNF
Ö
Ö FD(1) meeting
Ö Ö
E, H is fully depending BCNF Criteria
1) A,B,C,D → E,H A, B, C, D
on Minimal Key. since A, B, C, D
is Minimal Key.
is Minimal Key.
2) E→F
Ö X
Ö X
No Partial Dependency. E is not Minimal Key.
X
X
FD (3) does not fulfil
3) C, D → G Ö G is partially depending
2NF, thus not
X
on Minimal Key.
fulfilling 3NF.
Conclusion
R1 is in 1NF.
Phartheben Selvam (6186038)
CSCI235: Database
Decompose 2NF à BCNF
R1 = (A, B, C, D, E, F, G, H)
FD Decompose Minimal Key
1) A, B, C, D → E, H R1= (A, B, C, D, E, F, H)
2) E→F FD1: A, B, C, D → E, H R1= A, B, C, D
3) C, D → G FD2: E→F
R2 = C, D, G
FD1: C, D → G R2 = C, D
Decompose 3NF à BCNF
FD Decompose Minimal Key
R1= (A, B, C, D, E, F, H)
FD1: A, B, C, D → E, H
R1= (A, B, C, D, E, F, H)
FD2: E→F R1= A, B, C, D
FD1: A, B, C, D → E, H
R2 = C, D, G
FD1: C, D → G
R2 = C, D, G R2 = C, D
FD1: C, D → G
R3 = (E, F)
FD1: E → F R3 = E
Phartheben Selvam (6186038)
CSCI235: Database
Q2
ITEM (ItemID, PromotionID, Vendor, Style, Price)
1. FD1: ItemID, PromotionID → Vendor, Style, Price
2. FD2: ItemID → Vendor, Style
Minimal Key:
FD1: ItemID, PromotionID → Vendor, Style, Price
(ItemID, PromotionID) + → ItemID, PromotionID, Vendor, Style, Price
FD 1NF 2NF
3NF BCNF
Ö
Ö
Ö FD (1) meeting
(ItemID, BCNF Criteria
1) ItemID, PromotionID → Ö since the
Vendor, Style, Price is PromotionID) is a
Vendor, Style, Price determinant is a
fully depending on Minimal Key, but Minimal Key.
Minimal Key. (Vendor, Style,
Price) is a Non-
Prime Attribute.
X
X
2) ItemID → Vendor, Style
FD (2) does not fulfil
Ö Vendor, Style is 2NF, thus not
X
partially depending on fulfilling 3NF.
Minimal Key.
Conclusion
ITEM is in 1NF.
Phartheben Selvam (6186038)
CSCI235: Database
Decompose 2NF à 3NF à BCNF
ITEM (ItemID, PromotionID, Vendor, Style, Price)
FD Decompose Minimal Key
1) ItemID, PromotionID → ITEM (ItemID, PromotionID,
Price)
Vendor, Style, Price FD1: ItemID, PromotionID →
ItemID, PromotionID
2) ItemID → Vendor, Style Price
ITEM_Vendor (ItemID, Vendor,
Style) ItemID
FD1: ItemID → Vendor, Style
Conclusion
ITEM and ITEM_Vendor is in 3NF and BCNF form as their LHS is a minimal key, as
well as their RHS is non-prime attributes.
Phartheben Selvam (6186038)
CSCI235: Database
Q3
ORDER (Order_ID, LineItemNumber, ProductID, Quantity, Price)
FD1: Order_ID, LineItemNumber → ProductID, Quantity, Price
FD2: ProductID → Price
Minimal Key:
FD1: Order_ID, LineItemNumber → ProductID, Quantity, Price
(Order_ID, LineItemNumber) + = Order_ID, LineItemNumber, ProductID, Quantity,
Price
FD 1NF 2NF
3NF BCNF
Ö Ö
1) Order_ID, Ö FD (1) meeting
(Order_ID,
LineItemNumber → Ö BCNF Criteria
ProductID, Quantity, ProductID, Quantity, LineItemNumber ) is
since the
a Minimal Key, but
Price Price is fully depending determinant is a
(ProductID,
on Minimal Key. Minimal Key.
Quantity, Price) is a
Non-Prime
Attribute.
X
2) ProductID → Price Ö
Ö ProductID is not X
No Partial Dependency Minimal Key.
Conclusion
ORDER is in 2NF.
Phartheben Selvam (6186038)
CSCI235: Database
Decompose 2NF à 3NF à BCNF
ORDER (Order_ID, LineItemNumber, ProductID, Quantity, Price)
FD Decompose Minimal Key
ORDER (Order_ID,
1) FD1: Order_ID, LineItemNumber, ProductID,
LineItemNumber → Quantity)
ProductID, Quantity, FD1: Order_ID, Order_ID, LineItemNumber
Price LineItemNumber →
2) FD2: ProductID → ProductID, Quantity
Price
PRODUCT_PRICE
(ProductID, Price)
ProductID
FD1: ProductID → Price
Phartheben Selvam (6186038)
CSCI235: Database
Task 2
Rules
1NF – Remove repeating group of data.
2NF – Remove Partial Dependency.
3NF – Remove Transitive Dependency
BILL (Bill_No, Bill_Date, Date_Admitted, Date Disharged, Patient_No,
Patient_Name, Patient_Address, {Cost_ID, Cost_Name, {Item_Code, Description,
Amount}}, Staff_ID, Staff_Name)
1NF
BILL (Bill_No, Bill_Date, Date_Admitted, Date Disharged, Patient_No,
Patient_Name, Patient_Address, Staff_ID, Staff_Name)
BILL_COST (Bill_No, Cost_ID, Cost_Name)
ITEM_COST (Bill_No, Cost_ID, Item_Code, Description, Amount)
2NF
BILL (Bill_No, Bill_Date, Date_Admitted, Date Disharged, Patient_No,
Patient_Name, Patient_Address, Staff_ID, Staff_Name)
BILL_COST (Bill_No, Cost_ID)
COST_INFO(Cost_ID, Cost_Name)
ITEM_COST (Bill_No, Cost_ID, Item_Code)
ITEM_INFO (Item_Code, Description, Amount)
3NF
BILL (Bill_No, Bill_Date, Date_Admitted, Date Disharged, Patient_No, Staff_ID)
PATIENT_INFO(Patient_No, Patient_Name, Patient_Address)
STAFF_INFO(Staff_ID, Staff_Name)
BILL_COST (Bill_No, Cost_ID)
COST_INFO(Cost_ID, Cost_Name)
ITEM_COST (Bill_No, Cost_ID, Item_Code)
ITEM_INFO (Item_Code, Description, Amount)