120 likes | 268 Views
Normalization. Unnormalized Table. University. Course No. Course Desc. StdSSN. StdCity. StdClass. OfferNo. OffTerm. OffYear. Grade. Jun Jun. Fall Fall Winter Fall. 2000 2000 2000 2000. 3.5 3.3 3.1 3.4. O1 O2 O3 O2. Co1 Co2 Co3 Co2. S1 S2. C1 C2. DB VB OO
E N D
Unnormalized Table • University Course No Course Desc StdSSN StdCity StdClass OfferNo OffTerm OffYear Grade Jun Jun Fall Fall Winter Fall 2000 2000 2000 2000 3.5 3.3 3.1 3.4 O1 O2 O3 O2 Co1 Co2 Co3 Co2 S1 S2 C1 C2 DB VB OO VB
Relations Unnormalized • UNIVERSITY(StdSSN, StdCity, StdClass, (OfferNo, OffYear, Grade, CourseNo, CrsDesc)) 1NF • UNIVERSITY(StdSSN, StdCity, StdClass, OfferNo, OffYear, Grade, CourseNo, CrsDesc)
Conversion to 1NF • No repeating group • Primary key will expand in converting a non-1NF table to 1NF
Second Normal form • 1 NF. If every nonkey column is dependent on the whole key, not part of the key. • UNIVERSITY(StdSSN, StdCity, StdClass, OfferNo, OffYear, Grade, CourseNo, CrsDesc)
Functional Dependencies • StdSSN, OfferNo -> Grade • StdSSN -> StdCity, StdClass • OfferNo -> OffTerm, OffYear, CourseNo, CrsDesc • CourseNo -> CrsDesc
2NF conversion Split into 3 Tables: • Student(StdSSN, StdCity, StdClass) • Offer(OfferNo, OffTerm, OffYear, CourseNo, CrsDesc) • Grade (StdSSN, OfferNo, Grade)
Third Normal Form • 2NF, Determinants are the candidate keys. • Offer(OfferNo, OffTerm, OffYear, CourseNo, CrsDesc) • CourseNo -> CrsDesc • Split into two: • Offer(OfferNo, OffTerm, OffYear, CourseNo, CrsDesc) • Courses(CourseNo, CrsDesc)
3NF Tables • Student(StdSSN, StdCity, StdClass) • Offer(OfferNo, OffTerm, OffYear, CourseNo) • Courses(CourseNo, CrsDesc) • Grade (StdSSN, OfferNo, Grade)
Decomposition of 1NF Table into 2NF Tables IssueDate is determined by CatalogID alone, not by both CatalogID and ProductID
Conversion of 2NF Table into 3NF Tables ZipCode determines the value for State, and ZipCode is not the key to the table