1. Trang chủ
  2. » Giáo Dục - Đào Tạo

NguyenPHPSE62075 lab2

2 446 16

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 2
Dung lượng 14,34 KB

Nội dung

LAB2 Phạm Hoàng Phúc Nguyên- SE62075- Class: SE1069 Invoice(OrderID, OrderDate, CustomerID, CustomerName, CustomerAddress, ProductID, ProductDescription, ProductSrandardPrice, OrderedQuantity) FD: F1: OrderID → OrderDate, CustomerID, CustomerName, CustomerAddress F2: CustomerID → CustomerName, CustomerAddress F3: ProductID → ProductDescription, ProductStandardPrice F4: OrderID, ProductID → OrderedQuantity We let: Invoice R CustomerAddre ss E OrderID A ProductI D F OrderDate B ProductDescriptio n G CustomerID C ProductStandardPri ce H CustomerName D OrderedQuantit y I We have: R (A, B, C, D, E, F, G, H, L) FD: F1: A → B, C, D, E F2: C → D, E F3: F → G, H F4: A, F → I Key: K {A, F} Minimal basis: F1: A → B, C F2: C → D, E F3: F → G, H F4: A, F → I We see in F2 C is not a key and D, E are not a prime so this relation is not 3NF R1 (A, B, C) R2 (C, D, E) R3 (F, G, H) R4 (A, F, I) Because key K in F4 we have: R1 (A, B, C) R2 (C, D, E) R3 (F, G, H) R4 (A, F, I) Answer: after decompose the relation Invoice into 3NF we have relations: R1 (OrderID, OrderDate, CustomerID) R2 (CustomerID, CustomerName, CustomerAddress) R3 (ProductID, ProductDescription, ProductStandardPrice) R4 (OrderID, ProductID, OrderQuantity) Consider to the relation given, it’s easy to determine three functional dependencies They are: TechNo  TechName DepID  Department SchoolID  School Look at the relation we can see that TechNo is also determine DepID, but DepID determines Department >TechNo Department is a transitive functional dependency, we we can drop this case We have TechNoTechName and TechNoDepID, so TechNoTechName, DepID We also have JobNoSchoolID and {TechNo, JobNo}Hoursworked Therefore, we have functional dependencies in addition They are: TechNoTechName, DepID DepID  Department SchoolID  School JobNoSchoolID TechNo, JobNoHoursworked We have DepID is on the right side of TechNoTechName, DepID so, we also have TechNoTechName, DepID, Department Therefore: {TechNo, SchoolID, JobNo} + = {TechNo, TechName, DepID, Department, SchoolID, School, JobNo, Hoursworked} The attributes “Date” must be a member of Key because there is no FD contains it So, we have the key of this relation is: K = {TechNo, JobNo, Date} because it functionally determines all the attributes of the relation Now, this relation is not in 3NF because the FD TechNoTechName, DepID, the left side is not a superkey and the right side also not contain the attribute which is a member of Key *Compute minimal basic: Start 3NF synthesis by taking the attributes of FD as a relation schema so, we have some new relations: S1 (TechNo, TechName, DepID) S2 (DepID, Department) S3 (JobNo, SchoolID) S4 (SchoolID, School) S5 (TechNo, JobNo, Hoursworked) Since the key K is not a subset of the schema, we must add it to the schema say S6 (TechNo, JobNo, Date) Therefore, the final decomposition of the relation given is S1 (TechNo, TechName, DepID), S2 (DepID, Department), S3 (JobNo, SchoolID), S4 (SchoolID, School), S5 (TechNo, JobNo, Hoursworked), S6 (TechNo, JobNo, Date)

Ngày đăng: 26/10/2019, 23:54

w