You are on page 1of 5

1NF, 2NF, 3NF and BCNF in Database Normalization | DBMS Tutorial | Studytonight 2016-11-22, 2(49 PM

(http://www.studytonight.com/)
WRITE
Tutorials (http://studytonight.com/library/) Q & A Forum (http://studytonight.com/studyroom/) FOR US &
GET PAID!

DATABASE TECHNOLOGY
Tests (http://studytonight.com/tests/)
HTML Course (http://studytonight.com/code/) PRACTICE TESTS →
(/collaborate)

(/tests/?subject=dbms)
LogIn (http://www.studytonight.com/login) Suggest (http://www.studytonight.com/suggest)

TIBCO Jaspersoft Official


(https://play.google.com/store/apps/details?id=com.studytonight.app)
Interactive Reports & Dashboards. Easily Embeds into Any Application. Go to jaspersoft.com/download
SignUp (http://www.studytonight.com/register)

Database Concept
Normalization of Database
Overview of DBMS (overview-of-
Database Normalisation is a technique of organizing the data in the database. Normalization is a systematic
dbms)
approach of decomposing tables to eliminate data redundancy and undesirable characteristics like Insertion,
Database Architecture Update and Deletion Anamolies. It is a multi-step process that puts data into tabular form by removing duplicated
(architecture-of-database) data from the relation tables.

Database Model (database- Normalization is used for mainly two purpose,


model)
Eliminating reduntant(useless) data.
Codd's rule (codd-rule)
Ensuring data dependencies make sense i.e data is logically stored.
RDBMS Concept (rdbms-
concept)
Problem Without Normalization
Database key (database-key)
Without Normalization, it becomes difficult to handle and update the database, without facing data loss. Insertion,
Normalization (database-
normalization) Updation and Deletion Anamolies are very frequent if Database is not Normalized. To understand these
anomalies let us take an example of Student table.
E-R Diagrams (er-diagram)
S_id S_Name S_Address Subject_opted
Generalization and
Specialization (generalization- 401 Adam Noida Bio
and-specialization)
402 Alex Panipat Maths
SQL Concept
403 Stuart Jammu Maths
SQL Introduction (introduction-
404 Adam Noida Physics
to-sql)

DDL Command

Create query (create-query) Updation Anamoly : To update address of a student who occurs twice or more than twice in a table, we will

have to update S_Address column in all the rows, else data will become inconsistent.
Alter query (alter-query)
Insertion Anamoly : Suppose for a new admission, we have a Student id(S_id), name and address of a
Truncate, Drop and Rename
query (truncate-drop-rename- student but if student has not opted for any subjects yet then we have to insert NULL there, leading to

query) Insertion Anamoly.

Deletion Anamoly : If (S_id) 401 has only one subject and temporarily he drops it, when we delete that row,
DML Command
entire student record will be deleted along with it.
All DML command (dml-
command)

http://www.studytonight.com/dbms/database-normalization.php Page 1 of 5
1NF, 2NF, 3NF and BCNF in Database Normalization | DBMS Tutorial | Studytonight 2016-11-22, 2(49 PM

TCL Command Normalization Rule


All TCL Command (tcl- Normalization rule are divided into following normal form.
command)
1. First Normal Form
DCL Command 2. Second Normal Form

All DCL Command (dcl- 3. Third Normal Form


command)
4. BCNF
WHERE clause (where-clause)

SELECT query (select-query)


First Normal Form (1NF)
LIKE clause (like-clause)
As per First Normal Form, no two Rows of data must contain repeating group of information i.e each set of
ORDER BY clause (orderby- column must have a unique value, such that multiple columns cannot be used to fetch the same row. Each table
clause) should be organized into rows, and each row should have a primary key that distinguishes it as unique.

Group BY clause (groupby- The Primary key is usually a single column, but sometimes more than one column can be combined to create a
clause) single primary key. For example consider a table which is not in First normal form

Having clause (having-clause) Student Table :

DISTINCT keyword (distinct-


Student Age Subject
keyword)
Adam 15 Biology, Maths
AND & OR operator (sql-and-or-
operator) Alex 14 Maths

Advance SQL Stuart 17 Maths

SQL Constraints (sql-constraints)


In First Normal Form, any row must not have a column in which more than one value is saved, like separated
SQL function (sql-function)
with commas. Rather than that, we must separate such data into multiple rows.
SQL Join (joining-in-sql)
Student Table following 1NF will be :
SQL Alias (sql-alias)
Student Age Subject
SQL SET operation (set-
operation-in-sql) Adam 15 Biology

SQL Sequences (sql-sequences) Adam 15 Maths

SQL Views (sql-views) Alex 14 Maths

Stuart 17 Maths

Using the First Normal Form, data redundancy increases, as there will be many columns with same data in
multiple rows but each row as a whole will be unique.

Second Normal Form (2NF)


As per the Second Normal Form there must not be any partial dependency of any column on primary key. It
means that for a table that has concatenated primary key, each column in the table that is not part of the primary
key must depend upon the entire concatenated key for its existence. If any column depends only on one part of
the concatenated key, then the table fails Second normal form.

http://www.studytonight.com/dbms/database-normalization.php Page 2 of 5
1NF, 2NF, 3NF and BCNF in Database Normalization | DBMS Tutorial | Studytonight 2016-11-22, 2(49 PM

In example of First Normal Form there are two rows for Adam, to include multiple subjects that he has opted for.
While this is searchable, and follows First normal form, it is an inefficient use of space. Also in the above Table in
First Normal Form, while the candidate key is {Student, Subject}, Age of Student only depends on Student
column, which is incorrect as per Second Normal Form. To achieve second normal form, it would be helpful to
split out the subjects into an independent table, and match them up using the student names as foreign keys.

New Student Table following 2NF will be :

Student Age

Adam 15

Alex 14

Stuart 17

In Student Table the candidate key will be Student column, because all other column i.e Age is dependent on it.

New Subject Table introduced for 2NF will be :

Student Subject

Adam Biology

Adam Maths

Alex Maths

Stuart Maths

In Subject Table the candidate key will be {Student, Subject} column. Now, both the above tables qualifies for
Second Normal Form and will never suffer from Update Anomalies. Although there are a few complex cases in
which table in Second Normal Form suffers Update Anomalies, and to handle those scenarios Third Normal
Form is there.

Third Normal Form (3NF)


Third Normal form applies that every non-prime attribute of table must be dependent on primary key, or we can
say that, there should not be the case that a non-prime attribute is determined by another non-prime attribute. So
this transitive functional dependency should be removed from the table and also the table must be in Second
Normal form. For example, consider a table with following fields.

Student_Detail Table :

Student_id Student_name DOB Street city State Zip

In this table Student_id is Primary key, but street, city and state depends upon Zip. The dependency between zip
and other fields is called transitive dependency. Hence to apply 3NF, we need to move the street, city and
state to new table, with Zip as primary key.

New Student_Detail Table :

Student_id Student_name DOB Zip

Address Table :

http://www.studytonight.com/dbms/database-normalization.php Page 3 of 5
1NF, 2NF, 3NF and BCNF in Database Normalization | DBMS Tutorial | Studytonight 2016-11-22, 2(49 PM

Zip Street city state

The advantage of removing transtive dependency is,

Amount of data duplication is reduced.

Data integrity achieved.

Boyce and Codd Normal Form (BCNF)


Boyce and Codd Normal Form is a higher version of the Third Normal form. This form deals with certain type of
anamoly that is not handled by 3NF. A 3NF table which does not have multiple overlapping candidate keys is
said to be in BCNF. For a table to be in BCNF, following conditions must be satisfied:

R must be in 3rd Normal Form

and, for each functional dependency ( X -> Y ), X should be a super Key.

← Prev (database-key.php) Next → (er-diagram.php)

What is Studytonight? Tutorials Tests Learn to Code

About Us Core Java (/java) Core Java (/tests) HTML (/code/html)


(http://www.studytonight.com/about)
C++ (/cpp) C++ (/tests?/?subject=cpp)
How it Works (/howitworks)

http://www.studytonight.com/dbms/database-normalization.php Page 4 of 5
1NF, 2NF, 3NF and BCNF in Database Normalization | DBMS Tutorial | Studytonight 2016-11-22, 2(49 PM

Authors (/authors) Data Structures (/data-structures) DBMS (/tests?/?subject=dbms) (http://facebook.com/Studytonight)


(http://twitter.com/studytonight)
Collaborate (/collaborate) Jenkins Server (/jenkins) C Language (/tests?/?subject=c)
(https://plus.google.com/+Studytonight/)
Contact Us (/contact) DBMS (/dbms) More... (/tests)

Suggest (/suggest) Servlet (/servlet) © 2016 Studytonight

Blog (http://blog.studytonight.com) More... (/library)

http://www.studytonight.com/dbms/database-normalization.php Page 5 of 5

You might also like