***Welcome to ashrafedu.blogspot.com * * * This website is maintained by ASHRAF***

Posts

    Thursday, 21 April 2022

    4NF and 5NF

    Fourth normal form (4NF)

    Multivalue dependency occurs when two attributes (or columns) in a table are independent of one another, but both depend on a third attribute.

    For a dependency A -> B, if for a single value of A, multiple value of B exists, then the table may have multi-valued dependency. The table should have at least 3 attributes and B and C should be independent for A ->> B multivalued dependency.

    • A relation will be in 4NF if it is in Boyce Codd normal form and has no multi-valued dependency.
    • For a dependency A → B, if for a single value of A, multiple values of B exists, then the relation will be a multi-valued dependency

    STU_ID

    COURSE

    HOBBY

    21

    Computer

    Dancing

    21

    Math

    Singing

    34

    Chemistry

    Dancing

    74

    Biology

    Cricket

    59

    Physics

    Hockey

     

     

     

     

    The given STUDENT table is in 3NF, but the COURSE and HOBBY are two independent entity. Hence, there is no relationship between COURSE and HOBBY.

    In the STUDENT relation, a student with STU_ID, 21 contains two courses, Computer and Math and two hobbies, Dancing and Singing. So there is a Multi-valued dependency on STU_ID, which leads to unnecessary repetition of data.

    Decompose above table into two tables to make it in 4NF:

    student_course

    STU_ID

    COURSE

    21

    Computer

    21

    Math

    34

    Chemistry

    74

    Biology

    59

    Physics

     student_hobby

    STU_ID

    HOBBY

    21

    Dancing

    21

    Singing

    34

    Dancing

    74

    Cricket

    59

    Hockey

     

    Fifth normal form (5NF)

    Join dependency is a constraint which is similar to functional dependency or multivalued dependency. 

    A relation that has join dependency cannot be divided into two(or more) relations such that the resulting tables can be combined to form the original table.

    A relation is in 5NF if it is in 4NF and do not contains any join dependency and joining should be lossless.

    5NF is also known as Project-join normal form (PJ/NF).

    consider example:

    SUBJECT

    LECTURER

    SEMESTER

    Computer

    Anshika

    Semester 1

    Computer

    John

    Semester 1

    Math

    John

    Semester 1

    Math

    Akash

    Semester 2

    Chemistry

    Praveen

    Semester 1

     

    decompose it into three relations P1, P2 & P3:

    P1:

    SEMESTER

    SUBJECT

    Semester 1

    Computer

    Semester 1

    Math

    Semester 1

    Chemistry

    Semester 2

    Math

     

    P2:

    SUBJECT

    LECTURER

    Computer

    Anshika

    Computer

    John

    Math

    John

    Math

    Akash

    Chemistry

    Praveen

     

    P3:

    SEMSTER

    LECTURER

    Semester 1

    Anshika

    Semester 1

    John

    Semester 1

    John

    Semester 2

    Akash

    Semester 1

    Praveen

     

    The natural Join of all the three relations will give original relation. So original relation has no join dependency. Three decomposed relations are in 4NF and have no join dependency.


    Extended or Enhanced ER model

    Extended or Enhanced ER model

    Extended ER is a high-level data model that incorporates the extensions to the original ER model. Enhanced ER models are high level models that represent the requirements and complexities of complex databases.

    The extended Entity Relationship (ER) models are three types as given below −

    • Aggregation
    • Specialization
    • Generalization

    Specialization

    The process of designing sub groupings within an entity set is called specialization. It is a top-down process. If an entity set is given with all the attributes in which the instances of the entity set are differentiated according to the given attribute value, then that sub-classes or the sub-entity sets can be formed from the given attribute.

    Generalization

    It is the reverse process of specialization. It is a bottom-up approach.

    It converts subclasses to superclasses. This process combines a number of entity sets that share the same features into higher-level entity sets.

    If the superclass and sub-class information is given for the given entity set then, ISA relationship type will be used to represent the connectivity between the subclass and superclass as shown below –













    Aggregation

    It is an abstraction in which relationship sets are treated as higher level entity sets and can participate in relationships. Aggregation allows us to indicate that a relationship set participates in another relationship set.

    Aggregation is used to simplify the details of a given database where ternary relationships will be changed into binary relationships. Ternary relation is only one type of relationship which is working between three entities.