ScholarQuill logoScholarQuillUniversity Notes
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
Study Tools
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
Contact
ScholarQuill logo
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
ScholarQuill logoScholarQuillUniversity Notes
Study PortalCSI-308Normal Forms
Ctrl + K
Login
Explore
Search
Semester
Papers
CGPA
    CSI-308

    Database Systems

    Progress0 / 22 done
    Topics22
    1Basic Database Concepts2Entity Relationship Modelling3Relational Data Model and Algebra4Structured Query Language (SQL)5RDBMS6Database Design7Functional Dependencies8Normal Forms9Transaction Processing10Optimization Concepts11Concurrency Control12Recovery Techniques13Database Security and Authorization14Small Group Project Implementing a Database15Physical Database Design16Storage and File Structure17Indexed Files18B-Trees19Files with Dense Index20Files with Variable Length Records21Database Efficiency22Database Tuning
    6 min read
    Topic 8 of 22
    Topic Study Note Illustration
    08

    Normal Forms

    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...

    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)

    Database normalization
    Visual ReferenceDatabase Normalization
    Wikipedia

    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 view and download past papers

    Click on Show Past Papers to load available exam papers.

    Reading Progress
    0%
    6mremaining
    1.1kwords
    Intermediatelevel
    On This Page

    No headings found

    Study Toolkit

    Subject Portal

    Database Systems