Normalization is a systematic approach to organizing data in databases to reduce redundancy and enhance data integrity through the use of normal forms. The document outlines the various normal forms (1NF, 2NF, 3NF, BCNF, and 4NF) with definitions and examples of how to achieve each form. Each normal form addresses specific types of dependencies and relationships within the data to ensure optimal organization.
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
7 views
Normalization
Normalization is a systematic approach to organizing data in databases to reduce redundancy and enhance data integrity through the use of normal forms. The document outlines the various normal forms (1NF, 2NF, 3NF, BCNF, and 4NF) with definitions and examples of how to achieve each form. Each normal form addresses specific types of dependencies and relationships within the data to ensure optimal organization.
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11
Normalization
A systematic approach of organizing data in a database to eliminate
redundancy and improve data integrity. It involves dividing a database into two or more tables and defining relationships between the tables. There are several normal forms, each with specific rules. Normal forms First Normal Form (1NF) A relation is in 1NF if it only contains atomic (indivisible) values and each entry in a column is of the same data type. There should be no repeating groups or arrays. Example: | Student_ID | Subject | Marks | |------------|----------------|-------------| |1 | Math, Science | 85, 90 | |2 | English, Math | 78, 88 | Normalization to 1NF: Separate each subject with individual records .| Student_ID | Subject | Marks | |------------|----------|-------| |1 | Math | 85 | |1 | Science | 90 | |2 | English | 78 | |2 | Math | 88 | • Second Normal Form (2NF) • A relation is in 2NF if it is in 1NF and all non-key attributes are fully functionally dependent on the primary key. This step eliminates partial dependency (only applies if there’s a composite key). • Example:Suppose we have a table where the primary key is a combination of Student_ID and Subject. | Student_ID | Subject | Marks | Department | |------------|----------|-------|------------| |1 | Math | 85 | Science | |1 | Science | 90 | Science | |2 | English | 78 | Arts | |2 | Math | 88 | Science | • Normalization to 2NF:Separate Department into another table since it depends only on Subject, not on both Student_ID and Subject. • Student_Subject Table: • | Student_ID | Subject | Marks | • |------------|----------|-------| • |1 | Math | 85 | • |1 | Science | 90 | • |2 | English | 78 | • |2 | Math | 88 | • Subject_Department Table: • | Subject | Department | • | Math | Science | • | Science | Science | • | English | Arts | Third Normal Form (3NF) Definition: A relation is in 3NF if it is in 2NF, and all non- key attributes are non-transitively dependent on the primary key (i.e., there should be no transitive dependencies). Example:Consider the following table: | Student_ID | Subject | Marks | Department | HOD | |------------|----------|-------|-------------|------------| |1 | Math | 85 | Science | Dr. Smith | |1 | Science | 90 | Science | Dr. Smith | |2 | English | 78 | Arts | Dr. Brown | |2 | Math | 88 | Science | Dr. Smith | Here, HOD depends on Department, not directly on Student_ID and Subject. Normalization to 3NF:Create a separate table for Department and HOD. Student_Subject Table: | Student_ID | Subject | Marks | Department | |------------|----------|-------|-------------| |1 | Math | 85 | Science | |1 | Science | 90 | Science | |2 | English | 78 | Arts | |2 | Math | 88 | Science | Department_HOD Table: | Department | HOD | |------------|-----------| | Science | Dr. Smith | | Arts | Dr. Brown | 4. Boyce-Codd Normal Form (BCNF) Definition: A relation is in BCNF if it is in 3NF, and for every non-trivial functional dependency X -> Y, X is a super key. Example: | Course | Professor | Department | |---------|------------|------------| | Math | Dr. Allen | Science | | Math | Dr. Brown | Arts | Here, Course determines Professor (Course -> Professor), but Professor is not a super key. Normalization to BCNF:Split the table into two: Course_Professor Table: | Course | Professor | |---------|-----------| | Math | Dr. Allen | | Math | Dr. Brown | Professor_Department Table: | Professor | Department | |-----------|------------| | Dr. Allen | Science | | Dr. Brown | Arts | 5. Fourth Normal Form (4NF) Definition: A relation is in 4NF if it is in BCNF and has no multi-valued dependencies (MVDs). Example: | Student_ID | Course | Hobby | |------------|---------|-----------| |1 | Math | Chess | |1 | Math | Music | |1 | Science | Chess | |1 | Science | Music | Here, Student_ID has a multi-valued dependency on Course and Hobby. Normalization to 4NF:Separate Course and Hobby into individual tables. Student_Course Table: | Student_ID | Course | |------------|---------| |1 | Math | |1 | Science | Student_Hobby Table: | Student_ID | Hobby | |------------|--------| |1 | Chess | |1 | Music | Thankyou