SlideShare a Scribd company logo
Normalization in DBMS
Dr.M.Pyingkodi
Dept of MCA
Kongu Engineering College
Erode,Tamilnadu,India
pyingkodikongu@gmail.com
Relational Database Design
• It requires that we find a “good” collection of relation
schemas.
• Pit-falls in Relational Database design:
• A bad design may lead to
• a. Repetition of information – that leads to
• insertion, deletion, updation problems.
• b. Inability to represent certain Information.
2
Relational Database Design
• Design Goals:
• a. Avoid redundant data.
• b. Ensure that relationships among attributes are
represented.
• c. Facilitate the checking of updates for violation of
db integrity constraints.
3
Relational Database Design
• Example: Consider the relation schema:
• Lending-schema=(branch_name,branch_city,assets,customer_name,
loan_no,amount)
Here branch Adayar details are represented 2 times . This leads to a redudancy
problem.
Branch_
Name
Branch
_city
assets Customer
_name
Loan_no amount
Adayar
Bbbb
Cccc
Adayar
Chennai
XXXX
YYYY
Chennai
90,00,000
20,00,000
30,00,000
90,00,000
Anu
aaa
bbb
Barathi
L-01
L-02
L-03
L-04
1000
2000
3000
3500
4
Relational Database Design
• Redundancy:
• Data for branch_name,branch_city, assets are represented
for each loan that a branch makes
a. wastage space
b. Complicates updating,introducing inconsistency of
assets value.
Decomposition:
* Decompose the relation-schema, lending schema into,
5
Relational Database Design
• Branch-schema=(branch_name,branch_city,assets)
• Loan-schema =
(customer_name,loan_no,branch_name,amount)
• All attributes of original schema R must appear in
decomposition(R1,R2)
• R= R1 U R2
• Lossless join decomposition.
• All possible relations r on schema R.
• r = (r) (r)
• R1 R2
6
∏ ∏
Functional Dependencies
• It requires that the value for a certain set of attributes
determines uniquely the value for another set of attributes.
• In a given relation R, X and Y are attributes. Attributes Y is
functionally dependent on attribute X if each value of X
determines exactly one value of Y, which is represented as
X Y
i.e… “ X determines Y” or “Y is functionally dependent on X”
E.G…
Marks Grade
7
Functional Dependencies
• Types:
• A. Full Dependencies:
• In relation R, X and Y are attributes. X is functionally determines Y.
Subset of X should not be functionally determine Y.
• In the above eg. Marks is fully functionally dependent on student_no and
course_no together and not on subset of {student_no,course_no}
8
Marks
Student_No
Course_no
Functional Dependencies
• B. Partial Dependencies:
• Attribute Y is partial dependent on the
attribute X only if it is dependent on a subset
of attribute X.
• For eg.. Course_name, Instructor_name
are partially dependent on composite
attributes { student no, course_no} because
course_no alone defines course_name,
Instructor_name.
9
Functional Dependencies
• C. Transitive Dependencies:
X,Y and Z are 3 attributes in the relation R
X Y
Y Z
X Z
For e.g.. Grade depends on marks and in turn make depends on
{student_no course_no}, hence Grade depends fully
transitively on {student_no course_no}
10
NORMAL FORMS
• Normalisation:
Db designed based on E-R model may have some
amount of inconsistency (variation), uncertainty (in security)
and redundancy (duplication).
To eliminate these drawbacks some refinement has to
be done on the db.
Refinement process is called normalization.
Normalisation is defined as a step by step process of
decomposing a complex relation into a simple and stable
relations.
11
Purpose of Normalisation
• Minimize redundancy in data
• Remove insert, delete and update anomaly
(irregularity) during db activities.
• Reduce the need to recognize the data when it
is modified or enhanced.
• Because of duplicate data elimination, we will
be able to reduce the overall size of the db.
12
Normal Forms
• The different stages of normalization is called as normal
forms. They are,
• * 1NF
• * 2NF
• * 3NF
• * BCNF
13
First Normal Form(1NF)
• A relation schema R is in 1NF if
* all the attributes of the relation R are atomic in nature.
E.G… DEPT
Suppose we extend it by including DLOCATIONS attribute as
shown above. We assume that each dept may have a no. of
Locations.
This is not 1NF bcoz DLOCATIONS is not an atomic attribute.
DNAME DNO DHEAD DLOCATIONS
14
First Normal Form(1NF)
DNAME DNO DHEAD DLOCATIONS
Research 3 John (Mianus,Rye,Stratford)
Administrator 2 prince Mianus
Headquarter 1 Peter Rye
15
Dept:
First Normal Form(1NF)
• There are 2 main techniques to achieve 1NF,
1. Remove the attribute DLOCATIONS and place it in separate relation
DEPT_LOCATIONS along with a primary key DNO. The primary key of the
original DEPT is the combination {DNO,DLOCATIONS}
DEPT-LOCATIONS
DNO DLOCATIONS
1
2
3
3
3
Rye
Mianus
Rye
Mianus
stratford
16
First Normal Form(1NF)
• 2. Expand the key so that there will be a separate tuple in the orginal DEPT
relation for each location of a DEPT as shown below,
• So the first technique is superior.
DNAME DNO DHEAD DLOCATIONS
Research
Research
Research
Administration
HQ
3
3
3
2
1
John
John
John
Princy
Peter
Mianus
Rye
Statford
Mianus
Rye
17
Second Normal Form(2NF)
• A relation R is in 2NF if and only if,
• It is in the 1NF and
• No partial dependency exists between non-key
attributes and key attributes.
• The test for 2NF involves testing for functional
dependencies whose left hand side attributes are
part of primary key. If the primary key contains a
single attribute, the test need not be applied at all.
• A relation schema R is in 2NF if every non-prime attribute
A in R is fully functionally dependent on the primary key of
R.
18
Second Normal Form(2NF)
• E.G.. Consider the EMP_PROJ relation, it is in 1NF but not in 2NF,
The non-prime attribute ENAME violates 2NF because of FD2, as do the non-prime
attribute PNAME and PLOCATION because of FD2 and FD3 make ENAME, PNAME
and PLOCATION partially dependent on the primary key {SSN,PNO}, thus violating
2NF test.
19
PNAME
SSN PNO ENAME PLOCATION
HOURS
FD1
FD2
FD3
EMP-PROJ EMP-PROJ Relation in 1NF
Second Normal Form(2NF)
• The Functional dependencies FD1,FD2 and FD3 leads
to the decomposition of EMP_PROJ into the 3 relation
schemas EP1,EP2 and EP3, each of which is in 2NF.
SSN PNO HOURS SSN ENAME
20
EP2
EP1
PNO PNAME PLOCATION
EP3
FD1 FD2 FD3
Third Normal Form (3NF)
• A relation R is said to be in the 3NF if and only if
* It is in 2 NF and
* No transitive dependency exists between non-key attributes and key attributes.
E.G… Consider the relation schema EMP_DEPT
The dependency SSN DNGRSSN is transitive through DNO in EMP-DEPT,
because both the dependencies SSN DNO and DNO DNGRSSN hold
and DNO a key itself nor a subset of the key of EMP-DEPT is neither.
A relation schema R is n 3NF, if it satisfies 2NF and no non-prime attribute
of R is transitively dependent on the primary key.
ENAME SSN BDATE ADDRESS DNO DNAME DNGRSSN
21
EMP_DEPT Relation Schema in 2NF
Third Normal Form (3NF)
• We can normalize schemas ED1 and ED2,
• 3NF relation schemas ED1 and ED2
• Here ED1 and ED2 represet independent entity facts about employees and
departments.
ENAME SSN BDATE ADDRESS DNO
DNO DNAME DNGRSSN
22
ED1
ED2
Boyce-Codd Normal Form (BCNF)
• A relation R is said to be in BCNF, if and only if all the
determinant are candidate keys.
• BCNF relation is a strong 3NF, but not every 3NF relation is
BCNF.
• A relation schema R is in BCNF with respect to a set F of
functional dependencies if for all functional dependencies in
F of the form
• Where R and R,
23
Boyce-Codd Normal Form (BCNF)
• at least one of the following holds
• 1. is trivial (i.e )
• 2. is a super key of R
24
First Normal Form
• Domain is atomic if its elements are considered to be
indivisible units
– Examples of non-atomic domains:
• Set of names, composite attributes
• Identification numbers like CS101 that can be broken up into parts
• A relational schema R is in first normal form if the domains of
all attributes of R are atomic
• Non-atomic values complicate storage and encourage
redundant (repeated) storage of data
– Example: Set of accounts stored with each customer, and set of
owners stored with each account
– We assume all relations are in first normal form (and revisit this in
Chapter 9)
25

More Related Content

Similar to Normalization in DBMS

Chapter10
Chapter10Chapter10
Chapter10
sasa_eldoby
 
database Normalization
database Normalizationdatabase Normalization
database Normalization
Harsiddhi Thakkar
 
normalization ppt.pptx
normalization ppt.pptxnormalization ppt.pptx
normalization ppt.pptx
AbdusSadik
 
Theory of dependencies in relational database
Theory of dependencies in relational databaseTheory of dependencies in relational database
Theory of dependencies in relational databaseJyoti Ranjan Pattnaik
 
Normalization
NormalizationNormalization
Normalization
Sakshi Jaiswal
 
Normalization
NormalizationNormalization
Normalization
rehanlko007
 
Normalization1
Normalization1Normalization1
chapter 4-Functional Dependency and Normilization.pdf
chapter 4-Functional Dependency and Normilization.pdfchapter 4-Functional Dependency and Normilization.pdf
chapter 4-Functional Dependency and Normilization.pdf
MisganawAbeje1
 
Normalisation
NormalisationNormalisation
Normalisation
Soumyajit Dutta
 
Normalization and three normal forms.pptx
Normalization and three normal forms.pptxNormalization and three normal forms.pptx
Normalization and three normal forms.pptx
Zoha681526
 
Database Presentation
Database PresentationDatabase Presentation
Database Presentation
Malik Ghulam Murtza
 
Ertorelnotes
ErtorelnotesErtorelnotes
Ertorelnotes
Kamal Shrish
 
DATABASE MANAGEMENT SYSTEM
DATABASE MANAGEMENT SYSTEMDATABASE MANAGEMENT SYSTEM
DATABASE MANAGEMENT SYSTEM
Dr. GOPINATH D
 
normalization in database management system
normalization in database management systemnormalization in database management system
normalization in database management system
ssuser80a05c
 
Data Modeling
Data ModelingData Modeling
Data Modeling
DrkhanchanaR
 
Normalization(15.09.2010)
Normalization(15.09.2010)Normalization(15.09.2010)
Normalization(15.09.2010)
Ravi Shekhar
 
chap 10 dbms.pptx
chap 10 dbms.pptxchap 10 dbms.pptx
chap 10 dbms.pptx
arjun431527
 
Structured system analysis and design
Structured system analysis and design Structured system analysis and design
Structured system analysis and design
Jayant Dalvi
 

Similar to Normalization in DBMS (20)

Chapter10
Chapter10Chapter10
Chapter10
 
eaxmple of Normalisation
eaxmple of Normalisationeaxmple of Normalisation
eaxmple of Normalisation
 
database Normalization
database Normalizationdatabase Normalization
database Normalization
 
normalization ppt.pptx
normalization ppt.pptxnormalization ppt.pptx
normalization ppt.pptx
 
Theory of dependencies in relational database
Theory of dependencies in relational databaseTheory of dependencies in relational database
Theory of dependencies in relational database
 
Normalization
NormalizationNormalization
Normalization
 
Normalization
NormalizationNormalization
Normalization
 
Normalization1
Normalization1Normalization1
Normalization1
 
chapter 4-Functional Dependency and Normilization.pdf
chapter 4-Functional Dependency and Normilization.pdfchapter 4-Functional Dependency and Normilization.pdf
chapter 4-Functional Dependency and Normilization.pdf
 
Normalisation
NormalisationNormalisation
Normalisation
 
Normalization and three normal forms.pptx
Normalization and three normal forms.pptxNormalization and three normal forms.pptx
Normalization and three normal forms.pptx
 
Database Presentation
Database PresentationDatabase Presentation
Database Presentation
 
Ertorelnotes
ErtorelnotesErtorelnotes
Ertorelnotes
 
DATABASE MANAGEMENT SYSTEM
DATABASE MANAGEMENT SYSTEMDATABASE MANAGEMENT SYSTEM
DATABASE MANAGEMENT SYSTEM
 
normalization in database management system
normalization in database management systemnormalization in database management system
normalization in database management system
 
Chapter5.pptx
Chapter5.pptxChapter5.pptx
Chapter5.pptx
 
Data Modeling
Data ModelingData Modeling
Data Modeling
 
Normalization(15.09.2010)
Normalization(15.09.2010)Normalization(15.09.2010)
Normalization(15.09.2010)
 
chap 10 dbms.pptx
chap 10 dbms.pptxchap 10 dbms.pptx
chap 10 dbms.pptx
 
Structured system analysis and design
Structured system analysis and design Structured system analysis and design
Structured system analysis and design
 

More from Pyingkodi Maran

Health Monitoring System using IoT.doc
Health Monitoring System using IoT.docHealth Monitoring System using IoT.doc
Health Monitoring System using IoT.doc
Pyingkodi Maran
 
IoT Industry Adaptation of AI.ppt
IoT Industry Adaptation of AI.pptIoT Industry Adaptation of AI.ppt
IoT Industry Adaptation of AI.ppt
Pyingkodi Maran
 
IoT_Testing.ppt
IoT_Testing.pptIoT_Testing.ppt
IoT_Testing.ppt
Pyingkodi Maran
 
Azure Devops
Azure DevopsAzure Devops
Azure Devops
Pyingkodi Maran
 
Creation of Web Portal using DURPAL
Creation of Web Portal using DURPALCreation of Web Portal using DURPAL
Creation of Web Portal using DURPAL
Pyingkodi Maran
 
AWS Relational Database Instance
AWS Relational Database InstanceAWS Relational Database Instance
AWS Relational Database Instance
Pyingkodi Maran
 
AWS S3 Buckets
AWS S3  BucketsAWS S3  Buckets
AWS S3 Buckets
Pyingkodi Maran
 
Creation of AWS Instance in Cloud Platform
Creation of AWS Instance in Cloud PlatformCreation of AWS Instance in Cloud Platform
Creation of AWS Instance in Cloud Platform
Pyingkodi Maran
 
Amazon Web Service.pdf
Amazon Web Service.pdfAmazon Web Service.pdf
Amazon Web Service.pdf
Pyingkodi Maran
 
Cloud Security
Cloud SecurityCloud Security
Cloud Security
Pyingkodi Maran
 
Cloud Computing Introduction
Cloud Computing IntroductionCloud Computing Introduction
Cloud Computing Introduction
Pyingkodi Maran
 
Supervised Machine Learning Algorithm
Supervised Machine Learning AlgorithmSupervised Machine Learning Algorithm
Supervised Machine Learning Algorithm
Pyingkodi Maran
 
Unsupervised Learning in Machine Learning
Unsupervised Learning in Machine LearningUnsupervised Learning in Machine Learning
Unsupervised Learning in Machine Learning
Pyingkodi Maran
 
Feature Engineering in Machine Learning
Feature Engineering in Machine LearningFeature Engineering in Machine Learning
Feature Engineering in Machine Learning
Pyingkodi Maran
 
Relational Database and Relational Algebra
Relational Database and Relational AlgebraRelational Database and Relational Algebra
Relational Database and Relational Algebra
Pyingkodi Maran
 
Transaction in DBMS
Transaction in DBMSTransaction in DBMS
Transaction in DBMS
Pyingkodi Maran
 
IoT_Frameworks_.pdf
IoT_Frameworks_.pdfIoT_Frameworks_.pdf
IoT_Frameworks_.pdf
Pyingkodi Maran
 
IoT Real world Applications.pdf
IoT Real world Applications.pdfIoT Real world Applications.pdf
IoT Real world Applications.pdf
Pyingkodi Maran
 
IoT_Introduction.pdf
IoT_Introduction.pdfIoT_Introduction.pdf
IoT_Introduction.pdf
Pyingkodi Maran
 
Keys in DBMS
Keys in DBMSKeys in DBMS
Keys in DBMS
Pyingkodi Maran
 

More from Pyingkodi Maran (20)

Health Monitoring System using IoT.doc
Health Monitoring System using IoT.docHealth Monitoring System using IoT.doc
Health Monitoring System using IoT.doc
 
IoT Industry Adaptation of AI.ppt
IoT Industry Adaptation of AI.pptIoT Industry Adaptation of AI.ppt
IoT Industry Adaptation of AI.ppt
 
IoT_Testing.ppt
IoT_Testing.pptIoT_Testing.ppt
IoT_Testing.ppt
 
Azure Devops
Azure DevopsAzure Devops
Azure Devops
 
Creation of Web Portal using DURPAL
Creation of Web Portal using DURPALCreation of Web Portal using DURPAL
Creation of Web Portal using DURPAL
 
AWS Relational Database Instance
AWS Relational Database InstanceAWS Relational Database Instance
AWS Relational Database Instance
 
AWS S3 Buckets
AWS S3  BucketsAWS S3  Buckets
AWS S3 Buckets
 
Creation of AWS Instance in Cloud Platform
Creation of AWS Instance in Cloud PlatformCreation of AWS Instance in Cloud Platform
Creation of AWS Instance in Cloud Platform
 
Amazon Web Service.pdf
Amazon Web Service.pdfAmazon Web Service.pdf
Amazon Web Service.pdf
 
Cloud Security
Cloud SecurityCloud Security
Cloud Security
 
Cloud Computing Introduction
Cloud Computing IntroductionCloud Computing Introduction
Cloud Computing Introduction
 
Supervised Machine Learning Algorithm
Supervised Machine Learning AlgorithmSupervised Machine Learning Algorithm
Supervised Machine Learning Algorithm
 
Unsupervised Learning in Machine Learning
Unsupervised Learning in Machine LearningUnsupervised Learning in Machine Learning
Unsupervised Learning in Machine Learning
 
Feature Engineering in Machine Learning
Feature Engineering in Machine LearningFeature Engineering in Machine Learning
Feature Engineering in Machine Learning
 
Relational Database and Relational Algebra
Relational Database and Relational AlgebraRelational Database and Relational Algebra
Relational Database and Relational Algebra
 
Transaction in DBMS
Transaction in DBMSTransaction in DBMS
Transaction in DBMS
 
IoT_Frameworks_.pdf
IoT_Frameworks_.pdfIoT_Frameworks_.pdf
IoT_Frameworks_.pdf
 
IoT Real world Applications.pdf
IoT Real world Applications.pdfIoT Real world Applications.pdf
IoT Real world Applications.pdf
 
IoT_Introduction.pdf
IoT_Introduction.pdfIoT_Introduction.pdf
IoT_Introduction.pdf
 
Keys in DBMS
Keys in DBMSKeys in DBMS
Keys in DBMS
 

Recently uploaded

Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
PrashantGoswami42
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
ShahidSultan24
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
Kamal Acharya
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
MuhammadTufail242431
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 

Recently uploaded (20)

Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 

Normalization in DBMS

  • 1. Normalization in DBMS Dr.M.Pyingkodi Dept of MCA Kongu Engineering College Erode,Tamilnadu,India pyingkodikongu@gmail.com
  • 2. Relational Database Design • It requires that we find a “good” collection of relation schemas. • Pit-falls in Relational Database design: • A bad design may lead to • a. Repetition of information – that leads to • insertion, deletion, updation problems. • b. Inability to represent certain Information. 2
  • 3. Relational Database Design • Design Goals: • a. Avoid redundant data. • b. Ensure that relationships among attributes are represented. • c. Facilitate the checking of updates for violation of db integrity constraints. 3
  • 4. Relational Database Design • Example: Consider the relation schema: • Lending-schema=(branch_name,branch_city,assets,customer_name, loan_no,amount) Here branch Adayar details are represented 2 times . This leads to a redudancy problem. Branch_ Name Branch _city assets Customer _name Loan_no amount Adayar Bbbb Cccc Adayar Chennai XXXX YYYY Chennai 90,00,000 20,00,000 30,00,000 90,00,000 Anu aaa bbb Barathi L-01 L-02 L-03 L-04 1000 2000 3000 3500 4
  • 5. Relational Database Design • Redundancy: • Data for branch_name,branch_city, assets are represented for each loan that a branch makes a. wastage space b. Complicates updating,introducing inconsistency of assets value. Decomposition: * Decompose the relation-schema, lending schema into, 5
  • 6. Relational Database Design • Branch-schema=(branch_name,branch_city,assets) • Loan-schema = (customer_name,loan_no,branch_name,amount) • All attributes of original schema R must appear in decomposition(R1,R2) • R= R1 U R2 • Lossless join decomposition. • All possible relations r on schema R. • r = (r) (r) • R1 R2 6 ∏ ∏
  • 7. Functional Dependencies • It requires that the value for a certain set of attributes determines uniquely the value for another set of attributes. • In a given relation R, X and Y are attributes. Attributes Y is functionally dependent on attribute X if each value of X determines exactly one value of Y, which is represented as X Y i.e… “ X determines Y” or “Y is functionally dependent on X” E.G… Marks Grade 7
  • 8. Functional Dependencies • Types: • A. Full Dependencies: • In relation R, X and Y are attributes. X is functionally determines Y. Subset of X should not be functionally determine Y. • In the above eg. Marks is fully functionally dependent on student_no and course_no together and not on subset of {student_no,course_no} 8 Marks Student_No Course_no
  • 9. Functional Dependencies • B. Partial Dependencies: • Attribute Y is partial dependent on the attribute X only if it is dependent on a subset of attribute X. • For eg.. Course_name, Instructor_name are partially dependent on composite attributes { student no, course_no} because course_no alone defines course_name, Instructor_name. 9
  • 10. Functional Dependencies • C. Transitive Dependencies: X,Y and Z are 3 attributes in the relation R X Y Y Z X Z For e.g.. Grade depends on marks and in turn make depends on {student_no course_no}, hence Grade depends fully transitively on {student_no course_no} 10
  • 11. NORMAL FORMS • Normalisation: Db designed based on E-R model may have some amount of inconsistency (variation), uncertainty (in security) and redundancy (duplication). To eliminate these drawbacks some refinement has to be done on the db. Refinement process is called normalization. Normalisation is defined as a step by step process of decomposing a complex relation into a simple and stable relations. 11
  • 12. Purpose of Normalisation • Minimize redundancy in data • Remove insert, delete and update anomaly (irregularity) during db activities. • Reduce the need to recognize the data when it is modified or enhanced. • Because of duplicate data elimination, we will be able to reduce the overall size of the db. 12
  • 13. Normal Forms • The different stages of normalization is called as normal forms. They are, • * 1NF • * 2NF • * 3NF • * BCNF 13
  • 14. First Normal Form(1NF) • A relation schema R is in 1NF if * all the attributes of the relation R are atomic in nature. E.G… DEPT Suppose we extend it by including DLOCATIONS attribute as shown above. We assume that each dept may have a no. of Locations. This is not 1NF bcoz DLOCATIONS is not an atomic attribute. DNAME DNO DHEAD DLOCATIONS 14
  • 15. First Normal Form(1NF) DNAME DNO DHEAD DLOCATIONS Research 3 John (Mianus,Rye,Stratford) Administrator 2 prince Mianus Headquarter 1 Peter Rye 15 Dept:
  • 16. First Normal Form(1NF) • There are 2 main techniques to achieve 1NF, 1. Remove the attribute DLOCATIONS and place it in separate relation DEPT_LOCATIONS along with a primary key DNO. The primary key of the original DEPT is the combination {DNO,DLOCATIONS} DEPT-LOCATIONS DNO DLOCATIONS 1 2 3 3 3 Rye Mianus Rye Mianus stratford 16
  • 17. First Normal Form(1NF) • 2. Expand the key so that there will be a separate tuple in the orginal DEPT relation for each location of a DEPT as shown below, • So the first technique is superior. DNAME DNO DHEAD DLOCATIONS Research Research Research Administration HQ 3 3 3 2 1 John John John Princy Peter Mianus Rye Statford Mianus Rye 17
  • 18. Second Normal Form(2NF) • A relation R is in 2NF if and only if, • It is in the 1NF and • No partial dependency exists between non-key attributes and key attributes. • The test for 2NF involves testing for functional dependencies whose left hand side attributes are part of primary key. If the primary key contains a single attribute, the test need not be applied at all. • A relation schema R is in 2NF if every non-prime attribute A in R is fully functionally dependent on the primary key of R. 18
  • 19. Second Normal Form(2NF) • E.G.. Consider the EMP_PROJ relation, it is in 1NF but not in 2NF, The non-prime attribute ENAME violates 2NF because of FD2, as do the non-prime attribute PNAME and PLOCATION because of FD2 and FD3 make ENAME, PNAME and PLOCATION partially dependent on the primary key {SSN,PNO}, thus violating 2NF test. 19 PNAME SSN PNO ENAME PLOCATION HOURS FD1 FD2 FD3 EMP-PROJ EMP-PROJ Relation in 1NF
  • 20. Second Normal Form(2NF) • The Functional dependencies FD1,FD2 and FD3 leads to the decomposition of EMP_PROJ into the 3 relation schemas EP1,EP2 and EP3, each of which is in 2NF. SSN PNO HOURS SSN ENAME 20 EP2 EP1 PNO PNAME PLOCATION EP3 FD1 FD2 FD3
  • 21. Third Normal Form (3NF) • A relation R is said to be in the 3NF if and only if * It is in 2 NF and * No transitive dependency exists between non-key attributes and key attributes. E.G… Consider the relation schema EMP_DEPT The dependency SSN DNGRSSN is transitive through DNO in EMP-DEPT, because both the dependencies SSN DNO and DNO DNGRSSN hold and DNO a key itself nor a subset of the key of EMP-DEPT is neither. A relation schema R is n 3NF, if it satisfies 2NF and no non-prime attribute of R is transitively dependent on the primary key. ENAME SSN BDATE ADDRESS DNO DNAME DNGRSSN 21 EMP_DEPT Relation Schema in 2NF
  • 22. Third Normal Form (3NF) • We can normalize schemas ED1 and ED2, • 3NF relation schemas ED1 and ED2 • Here ED1 and ED2 represet independent entity facts about employees and departments. ENAME SSN BDATE ADDRESS DNO DNO DNAME DNGRSSN 22 ED1 ED2
  • 23. Boyce-Codd Normal Form (BCNF) • A relation R is said to be in BCNF, if and only if all the determinant are candidate keys. • BCNF relation is a strong 3NF, but not every 3NF relation is BCNF. • A relation schema R is in BCNF with respect to a set F of functional dependencies if for all functional dependencies in F of the form • Where R and R, 23
  • 24. Boyce-Codd Normal Form (BCNF) • at least one of the following holds • 1. is trivial (i.e ) • 2. is a super key of R 24
  • 25. First Normal Form • Domain is atomic if its elements are considered to be indivisible units – Examples of non-atomic domains: • Set of names, composite attributes • Identification numbers like CS101 that can be broken up into parts • A relational schema R is in first normal form if the domains of all attributes of R are atomic • Non-atomic values complicate storage and encourage redundant (repeated) storage of data – Example: Set of accounts stored with each customer, and set of owners stored with each account – We assume all relations are in first normal form (and revisit this in Chapter 9) 25