Вы находитесь на странице: 1из 3

1 st Normal Form

StudentID

Name

Course

Adam

Database Management, Software Engineering

Eve

Fashion Design, Clothing

John

Mathematics, Philosophy

This table is not in 1NF as the column Course is not atomic (I.e it can contain more than one value).
When the table is normalized to 1NF following 2 tables are obtained.
StudentID

Name

StudentID

Course

Adam

Database Management

Eve

Software Engineering

John

Fashion Design

Clothing

Mathematics

Philosophy

In the normalized tables it is clearly seen that each column is atomic. As a tradeoff we have redundant data
in the normalized form.
A table is said to be in 1NF form if it
1. contains only atomic values
2. contain no repeating groups.

2 nd Normal Form

Table: BOOK_PURCHASE_DETAIL
This table is not in 2NF
BookID
CustomerID

BookName

CustomerName

Java Cookbook

John

JavaCookbook

Nathan

Python in Action

Nathan

Know your C#

Natalie

When normalized
Table: Book
BookId BookName

Table: Customer
CustomerID CustomerName

Table: Customer_Purchase
CustomerID BookID

Java Cookbook

John

Python in Action

Nathan

Know Your C#

Natalie

Here initially the table is not normalized to 2NF. This is because a table is said to be in 2NF if,
1. it is already in 1NF.
2. it's non-key attributes are fully dependent on the primary key (No partial dependencies)
But in the above table the PK is (BookID, CustomerID) and you can see both BookName and
CustomerName are only partially depend on the complete primary key.
The above single table can be separated and normalized into 2NF as shown in the later tables. You can see
that they satisfy both conditions to be in 2NF.

3 rd Normal Form
Not normalized :
SongID

SongName

GenereID

Genere

Song A

Rock

Song B

Rock

Song C

Pop

Song D

Metal

Normalized:
SongID

SongName

GenereID

GenereID

Genere

Song A

Rock

Song B

Pop

Song C

Metal

Song D

A table is said to be in 3NF if,


1. it is already in 2NF
2. There are no transitive dependencies
Transitive dependencies are functional dependencies that exist between two or more non key attributes.
As for the above example we can see that there is a transitive dependency between GenereID and Genere.
So in order to put the table into 3NF we make Genere a separate table and add genereID as a column to
the Song table.

Вам также может понравиться