Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Tài liệu tham khảo về hệ thống cơ sở dữ liệu giới thiệu về bình thường hóa | COP 4710: Database Systems Spring 2004 Introduction to Normalization BÀI 10, ½ ngày School of Electrical Engineering and Computer Science University of Central Florida Instructor : Mark Llewellyn markl@cs.ucf.edu CC1 211, 823-2790 http://www.cs.ucf.edu/courses/cop4710/spr2004 Phd, MS, Under If R is a relational schema with attributes A1,A2, ., An and a set of functional dependencies F where X ⊆ {A1,A2,.,An} then X is a key of R if: X → A1A2.An F+, and no proper subset Y ⊆ X gives Y → A1A2.An F+. Basically, this definition means that you must attempt to generate the closure of all possible subsets of the schema of R and determine which sets produce all of the attributes in the schema. Determining the Keys of a Relation Schema Let r = (C, T, H, R, S, G) with F = {C T, HR C, HT R, CS G, HS R} Step 1: Generate (Ai)+ for 1 i n C+ = {CT}, T+ = {T}, H+ = {H} R+ = {R}, S+ = {S}, G+ = {G} no single attribute is a key for R Step 2: Generate (AiAj)+ for 1 i n, 1 j | COP 4710: Database Systems Spring 2004 Introduction to Normalization BÀI 10, ½ ngày School of Electrical Engineering and Computer Science University of Central Florida Instructor : Mark Llewellyn markl@cs.ucf.edu CC1 211, 823-2790 http://www.cs.ucf.edu/courses/cop4710/spr2004 Phd, MS, Under If R is a relational schema with attributes A1,A2, ., An and a set of functional dependencies F where X ⊆ {A1,A2,.,An} then X is a key of R if: X → A1A2.An F+, and no proper subset Y ⊆ X gives Y → A1A2.An F+. Basically, this definition means that you must attempt to generate the closure of all possible subsets of the schema of R and determine which sets produce all of the attributes in the schema. Determining the Keys of a Relation Schema Let r = (C, T, H, R, S, G) with F = {C T, HR C, HT R, CS G, HS R} Step 1: Generate (Ai)+ for 1 i n C+ = {CT}, T+ = {T}, H+ = {H} R+ = {R}, S+ = {S}, G+ = {G} no single attribute is a key for R Step 2: Generate (AiAj)+ for 1 i n, 1 j n (CT)+ = {C,T}, (CH)+ = {CHTR}, (CR)+ = {CRT} (CS)+ = {CSGT}, (CG)+ = {CGT}, (TH)+ = {THRC} (TR)+ = {TR}, (TS)+ = {TS}, (TG)+ = {TG} (HR)+ = {HRCT}, (HS)+ = {HSRCTG}, (HG)+ = {HG} (RS)+ = {RS}, (RG)+ = {RG}, (SG)+ = {SG} The attribute set (HS) is a key for R Determining Keys - Example Step 3: Generate (AiAjAk)+ for 1 i n, 1 j n, 1 k n (CTH)+ = {CTHR}, (CTR)+ = {CTR} (CTS)+ = {CTSG}, (CTG)+ = {CTG} (CHR)+ = {CHRT}, (CHS)+ = {CHSTRG} (CHG)+ = {CHGTR}, (CRS)+ = {CRSTG} (CRG)+ = {CRGT}, (CSG)+ = {CSGT} (THR)+ = {THRC}, (THS)+ = {THSRCG} (THG)+ = {THGRC}, (TRS)+ = {TRS} (TRG)+ = {TRG}, (TSG)+ = {TSG} (HRS)+ = {HRSCTG}, (HRG)+ = {HRGCT} (HSG)+ = {HSGRCT}, (RSG)+ = {RSG} Superkeys are shown in red. Determining Keys - Example Step 4: Generate (AiAjAkAr)+ for 1 i n, 1 j n, 1 k n, 1 r n (CTHR)+ = {CTHR}, (CTHS)+ = {CTHSRG} (CTHG)+ = {CTHGR}, (CHRS)+ = {CHRSTG} (CHRG)+ = {CHRGT}, (CRSG)+ = {CRSGT} (THRS)+ = {THRSCG}, (THRG)+ = {THRGC} (TRSG)+ = {TRSG}, (HRSG)+ = .