ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Database Systems
    CSI-308
    Progress0 / 22 topics
    Topics
    1. Basic Database Concepts2. Entity Relationship Modelling3. Relational Data Model and Algebra4. Structured Query Language (SQL)5. RDBMS6. Database Design7. Functional Dependencies8. Normal Forms9. Transaction Processing10. Optimization Concepts11. Concurrency Control12. Recovery Techniques13. Database Security and Authorization14. Small Group Project Implementing a Database15. Physical Database Design16. Storage and File Structure17. Indexed Files18. B-Trees19. Files with Dense Index20. Files with Variable Length Records21. Database Efficiency22. Database Tuning
    CSI-308›Normal Forms
    Database SystemsTopic 8 of 22

    Normal Forms

    6 minread
    1,061words
    Intermediatelevel

    Normal Forms (NF)

    Normal Forms (NF) are a set of guidelines or rules used in database design to ensure that a database is structured efficiently, with minimal redundancy and maximum data integrity. The process of normalizing a database involves breaking down complex tables into simpler ones, ensuring that data dependencies are properly managed, and avoiding potential anomalies.

    Normalization aims to achieve different normal forms (1NF, 2NF, 3NF, BCNF, and so on), each of which builds upon the previous one. By applying these rules step-by-step, we ensure that the database is free from unnecessary duplication and maintains logical consistency.


    1. First Normal Form (1NF)

    A table is in First Normal Form (1NF) if it satisfies the following conditions:

    • All columns must contain atomic values, meaning no column should contain multiple values or arrays. Each field should contain a single value.
    • Each column must contain values of a single data type.
    • The table should not have any repeating groups or nested tables.

    Example:

    Consider the following table:

    StudentID Name Courses
    101 Alice Math, Science
    102 Bob English, Math

    This table is not in 1NF because the "Courses" column contains multiple values for a single student (e.g., "Math, Science").

    To bring it into 1NF, we split the multiple values in the "Courses" column into separate rows:

    StudentID Name Course
    101 Alice Math
    101 Alice Science
    102 Bob English
    102 Bob Math

    Now, each field contains only atomic values, and the table is in 1NF.


    2. Second Normal Form (2NF)

    A table is in Second Normal Form (2NF) if it satisfies the following conditions:

    1. The table must be in First Normal Form (1NF).
    2. There must be no partial dependencies. A partial dependency occurs when a non-prime attribute (an attribute that is not part of a candidate key) depends on only a part of a composite primary key (a key that consists of more than one attribute).

    Example:

    Consider the following table with a composite primary key (StudentID, CourseID):

    StudentID CourseID Instructor Grade
    101 Math Mr. Smith A
    101 Science Mrs. Brown B
    102 Math Mr. Smith A

    Here, (StudentID, CourseID) is the primary key, but Instructor depends only on CourseID, not on the entire composite key. This is a partial dependency.

    To bring this table into 2NF, we separate the data into two tables: one for the student-course relationships and one for the course-instructor relationships.

    Student-Course Table (2NF):

    StudentID CourseID Grade
    101 Math A
    101 Science B
    102 Math A

    Course Table:

    CourseID Instructor
    Math Mr. Smith
    Science Mrs. Brown

    Now, there are no partial dependencies, and the tables are in 2NF.


    3. Third Normal Form (3NF)

    A table is in Third Normal Form (3NF) if it satisfies the following conditions:

    1. The table must be in Second Normal Form (2NF).
    2. There must be no transitive dependencies. A transitive dependency occurs when a non-prime attribute depends on another non-prime attribute, which in turn depends on the primary key.

    Example:

    Consider the following table:

    EmployeeID Name Department DepartmentLocation
    101 Alice HR Building A
    102 Bob IT Building B

    In this case, DepartmentLocation depends on Department, which in turn depends on EmployeeID. This is a transitive dependency.

    To bring the table into 3NF, we separate the data into two tables: one for the employees and their departments, and another for department locations.

    Employee Table:

    EmployeeID Name Department
    101 Alice HR
    102 Bob IT

    Department Table:

    Department DepartmentLocation
    HR Building A
    IT Building B

    Now, there are no transitive dependencies, and the tables are in 3NF.


    4. Boyce-Codd Normal Form (BCNF)

    A table is in Boyce-Codd Normal Form (BCNF) if it satisfies the following conditions:

    1. The table must be in Third Normal Form (3NF).
    2. For every non-trivial functional dependency (X → Y), X must be a superkey. A superkey is a set of attributes that can uniquely identify a tuple (record) in the table.

    Example:

    Consider the following table:

    StudentID CourseID Instructor
    101 Math Mr. Smith
    101 Science Mrs. Brown
    102 Math Mr. Smith

    In this case, (StudentID, CourseID) is the primary key. However, the functional dependency CourseID → Instructor violates BCNF because CourseID is not a superkey but still determines the Instructor.

    To bring this table into BCNF, we separate it into two tables: one for the course-instructor relationship and one for the student-course relationship.

    Course Table (BCNF):

    CourseID Instructor
    Math Mr. Smith
    Science Mrs. Brown

    Student-Course Table:

    StudentID CourseID
    101 Math
    101 Science
    102 Math

    Now, the table is in BCNF because in each functional dependency, the determinant is a superkey.


    5. Fourth Normal Form (4NF)

    A table is in Fourth Normal Form (4NF) if it satisfies the following conditions:

    1. The table must be in Boyce-Codd Normal Form (BCNF).
    2. There must be no multi-valued dependencies. A multi-valued dependency occurs when one attribute determines a set of attributes that can independently have multiple values.

    Example:

    Consider the following table:

    EmployeeID Skill Language
    101 Java English
    101 Python Spanish
    102 SQL French

    In this case, EmployeeID determines both Skill and Language, but these attributes are independent of each other. This creates a multi-valued dependency.

    To bring this into 4NF, we separate the attributes into two tables, removing the multi-valued dependency.

    Employee-Skill Table (4NF):

    EmployeeID Skill
    101 Java
    101 Python
    102 SQL

    Employee-Language Table (4NF):

    EmployeeID Language
    101 English
    101 Spanish
    102 French

    Now, the tables are in 4NF as the multi-valued dependency has been eliminated.


    6. Fifth Normal Form (5NF)

    A table is in Fifth Normal Form (5NF) if it satisfies the following conditions:

    1. The table must be in Fourth Normal Form (4NF).
    2. There must be no join dependencies, meaning that the table cannot be reconstructed by joining multiple tables. Every join dependency in the table should be implied by the candidate keys.

    5NF is rarely encountered in practical database design and typically applies to very complex scenarios involving intricate data relationships.


    Conclusion

    Normalization through normal forms is a crucial process in database design. Each normal form addresses specific types of redundancy and ensures that the database structure is optimized for integrity, consistency, and minimal data duplication. While normalization helps achieve an efficient database, it is important to strike a balance with performance requirements since highly normalized tables may require more complex queries or join operations, which can impact query performance.

    Previous topic 7
    Functional Dependencies
    Next topic 9
    Transaction Processing

    Past Papers

    Open this section to load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time6 min
      Word count1,061
      Code examples0
      DifficultyIntermediate