0% found this document useful (0 votes)
35 views3 pages

Normalization Forms With Examples

The document outlines the various normalization forms in SQL, detailing the rules and examples for First Normal Form (1NF), Second Normal Form (2NF), Third Normal Form (3NF), Boyce-Codd Normal Form (BCNF), and Fourth Normal Form (4NF). Each normalization form is explained with examples of violations and their corresponding decompositions. The document serves as a guide for understanding how to structure database tables to reduce redundancy and improve data integrity.

Uploaded by

karthik12420
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views3 pages

Normalization Forms With Examples

The document outlines the various normalization forms in SQL, detailing the rules and examples for First Normal Form (1NF), Second Normal Form (2NF), Third Normal Form (3NF), Boyce-Codd Normal Form (BCNF), and Fourth Normal Form (4NF). Each normalization form is explained with examples of violations and their corresponding decompositions. The document serves as a guide for understanding how to structure database tables to reduce redundancy and improve data integrity.

Uploaded by

karthik12420
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Normalization Forms in SQL with Examples

1. First Normal Form (1NF)


Rules:
- Each column must contain only atomic (indivisible) values.
- Each record must be unique.

Example (Not in 1NF):


| StudentID | Name | Courses |
|-----------|-------|-------------------|
|1 | Alice | Math, Science |
|2 | Bob | English, History |

Converted to 1NF:
| StudentID | Name | Course |
|-----------|-------|-----------|
|1 | Alice | Math |
|1 | Alice | Science |
|2 | Bob | English |
|2 | Bob | History |

2. Second Normal Form (2NF)


Rules:
- Must be in 1NF.
- No partial dependency on primary key.

Violation Example (1NF but not 2NF):


| StudentID | Course | InstructorName |
|-----------|----------|----------------|
|1 | Math | Mr. Smith |
|1 | Science | Ms. Jones |
|2 | English | Mr. Brown |

Decomposed:
StudentCourse Table:
| StudentID | Course |
|-----------|----------|
|1 | Math |
|1 | Science |
|2 | English |

CourseInstructor Table:
| Course | InstructorName |
|----------|----------------|
| Math | Mr. Smith |
| Science | Ms. Jones |
| English | Mr. Brown |

3. Third Normal Form (3NF)


Normalization Forms in SQL with Examples

Rules:
- Must be in 2NF.
- No transitive dependency.

Violation Example:
| StudentID | Name | ZipCode | City |
|-----------|-------|---------|---------------|
|1 | Alice | 10001 | New York |
|2 | Bob | 94105 | San Francisco |

Decomposed:
Student Table:
| StudentID | Name | ZipCode |
|-----------|-------|---------|
|1 | Alice | 10001 |
|2 | Bob | 94105 |

ZipCode Table:
| ZipCode | City |
|---------|---------------|
| 10001 | New York |
| 94105 | San Francisco |

4. Boyce-Codd Normal Form (BCNF)


Rules:
- Every determinant must be a candidate key.
- Stricter than 3NF.

Violation Example:
| Course | Instructor | TimeSlot |
|----------|------------|----------|
| Math | Smith | 9AM |
| Math | Smith | 10AM |

Decomposed:
TimeSlot determines Course
Course determines Instructor

5. Fourth Normal Form (4NF)


Rules:
- Must be in BCNF.
- No multi-valued dependencies.

Violation Example:
| Student | Course | Hobby |
|---------|--------|----------|
| Alice | Math | Painting |
| Alice | Math | Dancing |
Normalization Forms in SQL with Examples

Decomposed:
StudentCourse Table:
| Student | Course |
|---------|--------|
| Alice | Math |

StudentHobby Table:
| Student | Hobby |
|---------|----------|
| Alice | Painting |
| Alice | Dancing |

You might also like