정규화

Hermaeus Mora ·

  1. 1NF

    columns cannot contain relations or composite values 오직 단일값을 가져야 한다.

  2. 2NF

    It is in 1NF and has a single attribute unique identifier (UID)(in which case every non key attribute is dependent on the entire UID), or It is in 1NF and has a multi-attribute unique identifier, and every regular attribute (not part of the UID) is dependent on all attributes in the multi-attribute UID, not just one attribute (or part) of the UID. 후보 키의 진부분집합이 일반 키를 결정하지 않아야 한다.

    학생번호과목지도교수
    1수학김수학
    2과학이과학
    3과학이과학

    {학생번호, 과목}이 후보 키라고 하자. 과목이 지도교수를 결정하므로 제 2정규화를 만족하지 않는다.

  3. 3NF

    non-prime attributes depend only on the candidate keys and do not have a transitive dependency on another key 일반 키는 후보 키에만 종속되어야 하며 이행 종속적이지 않아야 한다.

    회원 번호등급할인율
    1vip50%
    2platinum30%

    회원번호가 후보 키라고 하자. 회원 번호 -> 등급이고 등급 -> 할인율이다. 따라서 회원 번호 -> 할인율이 성립한다. 이같은 관계를 이행 종속적이라고 하며 따라서 제 3정규화를 만족하지 않는다.

  4. BCNF

    XtoY(YsubeX), XX to Y (Y \\sube X), ~ X is a superkey 일반 키가 값을 결정하지 않아야 한다.

    코트예약시간예약 종료 시간코트 종류
    109:3010:30일반-A
    111:0012:00일반-A
    114:0015:30일반-B
    210:0011:30프리미엄-B
    211:3013:30프리미엄-B
    215:0016:30프리미엄-A

    위의 테이블의 후보 키 집합은 {코트, 예약 시간), {코트, 예약 종료시간}, {코트 종류, 예약 시간}, {코트 종류, 예약 종료 시간} 이다.

    여기서 코트 종류 -> 코트가 성립한다. 코트 종류는 슈퍼 키가 아니므로, BCNF를 만족하지 않는다.

  5. 4NF

    every one of its non-trivial multivalued dependencies XtwoheadrightarrowY(Y subseteqX), X,YX \\twoheadrightarrow Y (Y \ subseteq X), ~\\{X, Y\\} is a superkey 다치 속성의 결정자는 슈퍼 키여야 한다.

    StudentCourseHobby
    AliceMathTennis
    AliceScienceTennis
    AliceMathReading
    AliceScienceReading

    위의 테이블에서 Student to\\to Course, Student to\\to Hobby로 다치 속성이 존재한다. 그러나 Student는 슈퍼 키가 아니므로(슈퍼키=textStudent,Course,Hobby슈퍼 키 = \\{ \\text{Student, Course, Hobby}\\}) 위 테이블은 제 3정규형을 만족하지 않는다.

  6. 5NF

    every non-trivial join dependency in that table is implied by the candidate keys 조인 종속성을 가진 테이블은 후보 키를 통해 암시되어야 한다

    Traveling salesmanBrandProduct type
    Jack SchneiderAcmeVacuum cleaner
    Jack SchneiderAcmeBreadbox
    Mary JonesRobustoPruning shears
    Mary JonesRobustoVacuum cleaner
    Mary JonesRobustoBreadbox
    Mary JonesRobustoUmbrella stand
    Louis FergusonRobustoVacuum cleaner
    Louis FergusonRobustoTelescope
    Louis FergusonAcmeVacuum cleaner
    Louis FergusonAcmeLava lamp
    Louis FergusonNimbusTie rack

    위의 테이블은 다음과 같이 세 개의 테이블로 나눌 수 있다.

    Traveling salesmanProduct type
    Jack SchneiderVacuum cleaner
    Jack SchneiderBreadbox
    Mary JonesPruning shears
    Mary JonesVacuum cleaner
    Mary JonesBreadbox
    Mary JonesUmbrella stand
    Louis FergusonTelescope
    Louis FergusonVacuum cleaner
    Louis FergusonLava lamp
    Louis FergusonTie rack
    Traveling salesmanBrand
    Jack SchneiderAcme
    Mary JonesRobusto
    Louis FergusonRobusto
    Louis FergusonAcme
    Louis FergusonNimbus
    BrandProduct type
    AcmeVacuum cleaner
    AcmeBreadbox
    AcmeLava lamp
    RobustoPruning shears
    RobustoVacuum cleaner
    RobustoBreadbox
    RobustoUmbrella stand
    RobustoTelescope
    NimbusTie rack

    여기서 Traveling salesman-Brand 테이블과 Brand-Product type를 조인하면 Traveling salesman은 자신의 Brand가 가진 Product type을 Brand 후보 키를 통해 암시할 수 있다.