SlideShare a Scribd company logo
1 of 23
The Normal 
Forms 
3NF and 
BCNF
Preview 
• Normalization 
• Solution: Normal Forms 
• Introducing 3NF and BCNF 
• 3NF 
• Examples 
• BCNF
Normalization 
• Normalization is the process of efficiently 
organizing data in a database with two 
goals in mind 
• First goal: eliminate redundant data 
– for example, storing the same data in more 
than one table 
• Second Goal: ensure data dependencies 
make sense 
– for example, only storing related data in a 
table
Benefits of Normalization 
• Less storage space 
• Quicker updates 
• Less data inconsistency 
• Clearer data relationships 
• Easier to add data 
• Flexible Structure
The Solution: Normal Forms 
• Bad database designs results in: 
– redundancy: inefficient storage. 
– anomalies: data inconsistency, 
difficulties in maintenance 
• 1NF, 2NF, 3NF, BCNF are some 
of the early forms in the list that 
address this problem
Third Normal Form (3NF) 
1) Meet all the requirements of the 1NF 
2) Meet all the requirements of the 2NF 
3) Remove columns that are not dependent 
upon the primary key.
1) First normal form -1NF 
•11NNFF :: iiff aallll aattttrriibbuuttee vvaalluueess aarree 
aattoommiicc:: nnoo rreeppeeaattiinngg ggrroouupp,, nnoo 
ccoommppoossiittee aattttrriibbuutteess. 
• The following table is not in 1NF 
DDPPTT__NNOO MMGG__NNOO EEMMPP__NNOO EEMMPP__NNMM 
DD110011 1122334455 2200000000 
2200000011 
2200000022 
CCaarrll SSaaggaann 
MMaagg JJaammeess 
LLaarrrryy BBiirrdd 
DD110022 1133445566 3300000000 
3300000011 
JJiimm CCaarrtteerr 
PPaauull SSiimmoonn
Table in 1NF 
DDPPTT__NNOO MMGG__NNOO EEMMPP__NNOO EEMMPP__NNMM 
DD110011 1122334455 2200000000 CCaarrll SSaaggaann 
DD110011 1122334455 2200000011 MMaagg JJaammeess 
DD110011 1122334455 2200000022 LLaarrrryy BBiirrdd 
DD110022 1133445566 3300000000 JJiimm CCaarrtteerr 
DD110022 1133445566 
3300000011 
PPaauull SSiimmoonn 
• all attribute values are atomic because there are no repeating 
group and no composite attributes.
2) Second Normal Form 
– Second normal form (2NF) further addresses the 
concept of removing duplicative data: 
• A relation R is in 2NF if 
– (a) R is 1NF , and 
– (b) all non-prime attributes are fully dependent 
on the candidate keys. Which is creating 
relationships between these new tables and 
their predecessors through the use of foreign 
keys. 
• A prime attribute appears in a candidate key. 
• There is no partial dependency in 2NF. 
Example is next…
No dependencies on non-key attributes 
Inventory 
Description Supplier Cost Supplier Address 
There are two non-key fields. So, here are the questions: 
•If I know just Description, can I find out Cost? No, because 
we have more than one supplier for the same product. 
•If I know just Supplier, and I find out Cost? No, because I 
need to know what the Item is as well. 
Therefore, Cost is fully, functionally dependent upon the 
ENTIRE PK (Description-Supplier) for its existence. 
Inventory 
Description Supplier Cost
CONTINUED… 
Description Supplier Cost Supplier Address 
•If I know just Description, can I find out Supplier Address? 
No, 
because we have more than one supplier for the same 
product. 
•If I know just Supplier, and I find out Supplier Address? 
Yes. 
The Address does not depend upon the description of the 
item. 
Therefore, Supplier Address is NOT functionally dependent 
upon the ENTIRE PK (Description-Supplier) 
for its existence. 
Supplier 
Inventory 
Name Supplier Address
So putting things together 
Description Supplier Cost Supplier Address 
Description Supplier Cost 
Supplier 
Inventory 
Inventory 
Name Supplier Address 
The above relation is now in 2NF since the rreellaattiioonn hhaass nnoo 
nnoonn--kkeeyy aattttrriibbuutteess.
3) Remove columns that are not 
dependent upon the primary key. 
So for every nontrivial functional dependency XX ---->> AA,, 
((11)) XX iiss aa ssuuppeerrkkeeyy,, oorr 
((22)) AA iiss aa pprriimmee ((kkeeyy)) aattttrriibbuuttee..
Example of 3NF 
Books 
Name Author's Name Author's Non-de 
Plume # of Pages 
•If I know # of Pages, can I find out Author's Name? No. Can I find out 
Author's Non-de Plume? No. 
•If I know Author's Name, can I find out # of Pages? No. Can I find out 
Author's Non-de Plume? YES. 
Therefore, Author's Non-de Plume is functionally dependent upon Author's 
Name, not the PK for its existence. It has to go. 
Books 
Name Author's Name # of Pages 
Author 
Name Non-de Plume
Another example: Suppose we have relation S 
• S(SUPP#, PART#, SNAME, QUANTITY) with the following 
assumptions: 
• (1) SUPP# is unique for every supplier. 
(2) SNAME is unique for every supplier. 
(3) QUANTITY is the accumulated quantities of a part supplied by 
a supplier. 
(4) A supplier can supply more than one part. 
(5) A part can be supplied by more than one supplier. 
• We can find the following nontrivial functional dependencies: 
• (1) SUPP# --> SNAME 
(2) SNAME --> SUPP# 
(3) SUPP# PART# --> QUANTITY 
(4) SNAME PART# --> QUANTITY 
• The candidate keys are: 
• (1) SUPP# PART# 
(2) SNAME PART# 
• The relation is in 3NF.
The table in 3NF 
SSUUPPPP# SSNNAAMMEE PPAARRTT# QQTTYY 
SS11 
YYuueess PP11 
110000 
SS11 YYuueess PP22 220000 
SS22 YYuueess PP33 225500 
SS22 JJoonneess PP11 330000
Example with first three forms 
Suppose we have tthhiiss IInnvvooiiccee TTaabbllee 
FFiirrsstt NNoorrmmaall FFoorrmm: NNoo rreeppeeaattiinngg 
ggrroouuppss.. 
•The above table violates 1NF because it has columns 
for the first, second, and third line item. 
•Solution: you make a separate line item table, with it's 
own key, in this case the combination of invoice
Table now in 1NF
Second Normal Form: 
Each column must depend on the *entire* primary key.
Third Normal Form: 
Each column must depend on *directly* on the primary 
key.
Boyce-Codd Normal Form 
(BCNF) 
Boyce-Codd normal form (BCNF) 
A relation is in BCNF, if and only if, every determinant is a 
candidate key. 
The difference between 3NF and BCNF is that for a functional 
dependency A  B, 3NF allows this dependency in a relation 
if B is a primary-key attribute and A is not a candidate key, 
whereas BCNF insists that for this dependency to remain in a 
relation, A must be a candidate key.
ClientInterview 
CClliieennttNN 
oo 
iinntteerrvviieewwDDaattee iinntteerrvviieewwTTiimmee ssttaaffffNNoo rroooommNNoo 
CCRR7766 1133--MMaayy--0022 1100..3300 SSGG55 GG110011 
CCRR7766 1133--MMaayy--0022 1122..0000 SSGG55 GG110011 
CCRR7744 1133--MMaayy--0022 1122..0000 SSGG3377 GG110022 
CCRR5566 11--JJuull--0022 1100..3300 SSGG55 GG110022 
• FD1 clientNo, interviewDate  interviewTime, staffNo, roomNo (Primary Key) 
• FD2 staffNo, interviewDate, interviewTime clientNo (Candidate key) 
• FD3 roomNo, interviewDate, interviewTime  clientNo, staffNo (Candidate key) 
• FD4 staffNo, interviewDate  roomNo (not a candidate key) 
• As a consequece the ClientInterview relation may suffer from update anmalies. 
• For example, two tuples have to be updated if the roomNo need be changed for 
staffNo SG5 on the 13-May-02.
Example of BCNF(2) 
To transform the ClientInterview relation to BCNF, we must remove 
the violating functional dependency by creating two new relations 
called Interview and StaffRoom as shown below, 
Interview (clientNo, interviewDate, interviewTime, staffNo) 
StaffRoom(staffNo, interviewDate, roomNo) 
Interview 
CClliieennttNNoo iinntteerrvviieewwDDaattee iinntteerrvviieewwTTiimmee ssttaaffffNNoo 
CCRR7766 1133--MMaayy--0022 1100..3300 SSGG55 
CCRR7766 1133--MMaayy--0022 1122..0000 SSGG55 
CCRR7744 1133--MMaayy--0022 1122..0000 SSGG3377 
CCRR5566 11--JJuull--0022 1100..3300 SSGG55 
StaffRoom 
ssttaaffffNNoo iinntteerrvviieewwDDaattee rroooommNNoo 
SSGG55 1133--MMaayy--0022 GG110011 
SSGG3377 1133--MMaayy--0022 GG110022 
SSGG55 11--JJuull--0022 GG110022 
BCNF Interview and StaffRoom relations

More Related Content

What's hot

Entity relationship diagram - Concept on normalization
Entity relationship diagram - Concept on normalizationEntity relationship diagram - Concept on normalization
Entity relationship diagram - Concept on normalizationSatya Pal
 
Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Oum Saokosal
 
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NFNormalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NFBiplap Bhattarai
 
Normalization in a Database
Normalization in a DatabaseNormalization in a Database
Normalization in a DatabaseBishrul Haq
 
Normalisation - 2nd normal form
Normalisation - 2nd normal formNormalisation - 2nd normal form
Normalisation - 2nd normal formcollege
 
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFDatabase Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFOum Saokosal
 
Database normalization
Database normalizationDatabase normalization
Database normalizationJignesh Jain
 
Lecture 04 normalization
Lecture 04 normalization Lecture 04 normalization
Lecture 04 normalization emailharmeet
 
Normalization
NormalizationNormalization
Normalizationlingesan
 
Normalization PRESENTATION
Normalization PRESENTATIONNormalization PRESENTATION
Normalization PRESENTATIONbit allahabad
 
Database Management Systems 4 - Normalization
Database Management Systems 4 - NormalizationDatabase Management Systems 4 - Normalization
Database Management Systems 4 - NormalizationNickkisha Farrell
 
Normalization in Database
Normalization in DatabaseNormalization in Database
Normalization in DatabaseRoshni Singh
 

What's hot (20)

Entity relationship diagram - Concept on normalization
Entity relationship diagram - Concept on normalizationEntity relationship diagram - Concept on normalization
Entity relationship diagram - Concept on normalization
 
Bcnf
BcnfBcnf
Bcnf
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)
 
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NFNormalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
 
Normalization in a Database
Normalization in a DatabaseNormalization in a Database
Normalization in a Database
 
Normalisation - 2nd normal form
Normalisation - 2nd normal formNormalisation - 2nd normal form
Normalisation - 2nd normal form
 
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFDatabase Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
 
Normalization
NormalizationNormalization
Normalization
 
Database normalization
Database normalizationDatabase normalization
Database normalization
 
Lecture 04 normalization
Lecture 04 normalization Lecture 04 normalization
Lecture 04 normalization
 
Normalization
NormalizationNormalization
Normalization
 
Dbms 4NF & 5NF
Dbms 4NF & 5NFDbms 4NF & 5NF
Dbms 4NF & 5NF
 
Normalization
NormalizationNormalization
Normalization
 
Normalization
NormalizationNormalization
Normalization
 
Normalization PRESENTATION
Normalization PRESENTATIONNormalization PRESENTATION
Normalization PRESENTATION
 
Database Management Systems 4 - Normalization
Database Management Systems 4 - NormalizationDatabase Management Systems 4 - Normalization
Database Management Systems 4 - Normalization
 
Normalization in Database
Normalization in DatabaseNormalization in Database
Normalization in Database
 
Database Normalization by Dr. Kamal Gulati
Database Normalization by Dr. Kamal GulatiDatabase Normalization by Dr. Kamal Gulati
Database Normalization by Dr. Kamal Gulati
 
Dbms normalization
Dbms normalizationDbms normalization
Dbms normalization
 

Similar to functional dependencies with example

Similar to functional dependencies with example (20)

Chapter+3+-+Normalization.pdf
Chapter+3+-+Normalization.pdfChapter+3+-+Normalization.pdf
Chapter+3+-+Normalization.pdf
 
Normalization.ppt
Normalization.pptNormalization.ppt
Normalization.ppt
 
Normalisation revision
Normalisation revisionNormalisation revision
Normalisation revision
 
Normalization
NormalizationNormalization
Normalization
 
Normalization
NormalizationNormalization
Normalization
 
Database Normalization.ppt
Database Normalization.pptDatabase Normalization.ppt
Database Normalization.ppt
 
normalization.ppt
normalization.pptnormalization.ppt
normalization.ppt
 
normalization-Normalization -Process of Divide Tables
normalization-Normalization -Process of Divide Tablesnormalization-Normalization -Process of Divide Tables
normalization-Normalization -Process of Divide Tables
 
normalization in Database Management Systems.ppt
normalization in Database Management Systems.pptnormalization in Database Management Systems.ppt
normalization in Database Management Systems.ppt
 
normalization.ppt
normalization.pptnormalization.ppt
normalization.ppt
 
normalization.ppt
normalization.pptnormalization.ppt
normalization.ppt
 
Kumar lav
Kumar lavKumar lav
Kumar lav
 
Normalization and three normal forms.pptx
Normalization and three normal forms.pptxNormalization and three normal forms.pptx
Normalization and three normal forms.pptx
 
Presentation on Normalization.pptx
Presentation on Normalization.pptxPresentation on Normalization.pptx
Presentation on Normalization.pptx
 
Relational database design
Relational database designRelational database design
Relational database design
 
Mca ii-dbms-u-iv-structured query language
Mca ii-dbms-u-iv-structured query languageMca ii-dbms-u-iv-structured query language
Mca ii-dbms-u-iv-structured query language
 
Normalisation by vmb
Normalisation by vmbNormalisation by vmb
Normalisation by vmb
 
8 normalization (1)
8 normalization (1)8 normalization (1)
8 normalization (1)
 
Normalization (1)
Normalization (1)Normalization (1)
Normalization (1)
 
8 Normalization (1).ppt
8 Normalization (1).ppt8 Normalization (1).ppt
8 Normalization (1).ppt
 

More from Siddhi Viradiya

network convergence problem and solutions
network convergence  problem and solutionsnetwork convergence  problem and solutions
network convergence problem and solutionsSiddhi Viradiya
 
Pagereplacement algorithm(computional concept)
Pagereplacement algorithm(computional concept)Pagereplacement algorithm(computional concept)
Pagereplacement algorithm(computional concept)Siddhi Viradiya
 
bus and memory tranfer (computer organaization)
bus and memory tranfer (computer organaization)bus and memory tranfer (computer organaization)
bus and memory tranfer (computer organaization)Siddhi Viradiya
 
chapter 1 intoduction to operating system
chapter 1 intoduction to operating systemchapter 1 intoduction to operating system
chapter 1 intoduction to operating systemSiddhi Viradiya
 
non linear data structure -introduction of tree
non linear data structure -introduction of treenon linear data structure -introduction of tree
non linear data structure -introduction of treeSiddhi Viradiya
 

More from Siddhi Viradiya (7)

network convergence problem and solutions
network convergence  problem and solutionsnetwork convergence  problem and solutions
network convergence problem and solutions
 
Pagereplacement algorithm(computional concept)
Pagereplacement algorithm(computional concept)Pagereplacement algorithm(computional concept)
Pagereplacement algorithm(computional concept)
 
bus and memory tranfer (computer organaization)
bus and memory tranfer (computer organaization)bus and memory tranfer (computer organaization)
bus and memory tranfer (computer organaization)
 
chapter 1 intoduction to operating system
chapter 1 intoduction to operating systemchapter 1 intoduction to operating system
chapter 1 intoduction to operating system
 
non linear data structure -introduction of tree
non linear data structure -introduction of treenon linear data structure -introduction of tree
non linear data structure -introduction of tree
 
AEM Fourier series
 AEM Fourier series AEM Fourier series
AEM Fourier series
 
global warming ch-07
 global warming ch-07 global warming ch-07
global warming ch-07
 

Recently uploaded

Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 

Recently uploaded (20)

Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 

functional dependencies with example

  • 1. The Normal Forms 3NF and BCNF
  • 2. Preview • Normalization • Solution: Normal Forms • Introducing 3NF and BCNF • 3NF • Examples • BCNF
  • 3. Normalization • Normalization is the process of efficiently organizing data in a database with two goals in mind • First goal: eliminate redundant data – for example, storing the same data in more than one table • Second Goal: ensure data dependencies make sense – for example, only storing related data in a table
  • 4. Benefits of Normalization • Less storage space • Quicker updates • Less data inconsistency • Clearer data relationships • Easier to add data • Flexible Structure
  • 5. The Solution: Normal Forms • Bad database designs results in: – redundancy: inefficient storage. – anomalies: data inconsistency, difficulties in maintenance • 1NF, 2NF, 3NF, BCNF are some of the early forms in the list that address this problem
  • 6. Third Normal Form (3NF) 1) Meet all the requirements of the 1NF 2) Meet all the requirements of the 2NF 3) Remove columns that are not dependent upon the primary key.
  • 7. 1) First normal form -1NF •11NNFF :: iiff aallll aattttrriibbuuttee vvaalluueess aarree aattoommiicc:: nnoo rreeppeeaattiinngg ggrroouupp,, nnoo ccoommppoossiittee aattttrriibbuutteess. • The following table is not in 1NF DDPPTT__NNOO MMGG__NNOO EEMMPP__NNOO EEMMPP__NNMM DD110011 1122334455 2200000000 2200000011 2200000022 CCaarrll SSaaggaann MMaagg JJaammeess LLaarrrryy BBiirrdd DD110022 1133445566 3300000000 3300000011 JJiimm CCaarrtteerr PPaauull SSiimmoonn
  • 8. Table in 1NF DDPPTT__NNOO MMGG__NNOO EEMMPP__NNOO EEMMPP__NNMM DD110011 1122334455 2200000000 CCaarrll SSaaggaann DD110011 1122334455 2200000011 MMaagg JJaammeess DD110011 1122334455 2200000022 LLaarrrryy BBiirrdd DD110022 1133445566 3300000000 JJiimm CCaarrtteerr DD110022 1133445566 3300000011 PPaauull SSiimmoonn • all attribute values are atomic because there are no repeating group and no composite attributes.
  • 9. 2) Second Normal Form – Second normal form (2NF) further addresses the concept of removing duplicative data: • A relation R is in 2NF if – (a) R is 1NF , and – (b) all non-prime attributes are fully dependent on the candidate keys. Which is creating relationships between these new tables and their predecessors through the use of foreign keys. • A prime attribute appears in a candidate key. • There is no partial dependency in 2NF. Example is next…
  • 10. No dependencies on non-key attributes Inventory Description Supplier Cost Supplier Address There are two non-key fields. So, here are the questions: •If I know just Description, can I find out Cost? No, because we have more than one supplier for the same product. •If I know just Supplier, and I find out Cost? No, because I need to know what the Item is as well. Therefore, Cost is fully, functionally dependent upon the ENTIRE PK (Description-Supplier) for its existence. Inventory Description Supplier Cost
  • 11. CONTINUED… Description Supplier Cost Supplier Address •If I know just Description, can I find out Supplier Address? No, because we have more than one supplier for the same product. •If I know just Supplier, and I find out Supplier Address? Yes. The Address does not depend upon the description of the item. Therefore, Supplier Address is NOT functionally dependent upon the ENTIRE PK (Description-Supplier) for its existence. Supplier Inventory Name Supplier Address
  • 12. So putting things together Description Supplier Cost Supplier Address Description Supplier Cost Supplier Inventory Inventory Name Supplier Address The above relation is now in 2NF since the rreellaattiioonn hhaass nnoo nnoonn--kkeeyy aattttrriibbuutteess.
  • 13. 3) Remove columns that are not dependent upon the primary key. So for every nontrivial functional dependency XX ---->> AA,, ((11)) XX iiss aa ssuuppeerrkkeeyy,, oorr ((22)) AA iiss aa pprriimmee ((kkeeyy)) aattttrriibbuuttee..
  • 14. Example of 3NF Books Name Author's Name Author's Non-de Plume # of Pages •If I know # of Pages, can I find out Author's Name? No. Can I find out Author's Non-de Plume? No. •If I know Author's Name, can I find out # of Pages? No. Can I find out Author's Non-de Plume? YES. Therefore, Author's Non-de Plume is functionally dependent upon Author's Name, not the PK for its existence. It has to go. Books Name Author's Name # of Pages Author Name Non-de Plume
  • 15. Another example: Suppose we have relation S • S(SUPP#, PART#, SNAME, QUANTITY) with the following assumptions: • (1) SUPP# is unique for every supplier. (2) SNAME is unique for every supplier. (3) QUANTITY is the accumulated quantities of a part supplied by a supplier. (4) A supplier can supply more than one part. (5) A part can be supplied by more than one supplier. • We can find the following nontrivial functional dependencies: • (1) SUPP# --> SNAME (2) SNAME --> SUPP# (3) SUPP# PART# --> QUANTITY (4) SNAME PART# --> QUANTITY • The candidate keys are: • (1) SUPP# PART# (2) SNAME PART# • The relation is in 3NF.
  • 16. The table in 3NF SSUUPPPP# SSNNAAMMEE PPAARRTT# QQTTYY SS11 YYuueess PP11 110000 SS11 YYuueess PP22 220000 SS22 YYuueess PP33 225500 SS22 JJoonneess PP11 330000
  • 17. Example with first three forms Suppose we have tthhiiss IInnvvooiiccee TTaabbllee FFiirrsstt NNoorrmmaall FFoorrmm: NNoo rreeppeeaattiinngg ggrroouuppss.. •The above table violates 1NF because it has columns for the first, second, and third line item. •Solution: you make a separate line item table, with it's own key, in this case the combination of invoice
  • 19. Second Normal Form: Each column must depend on the *entire* primary key.
  • 20. Third Normal Form: Each column must depend on *directly* on the primary key.
  • 21. Boyce-Codd Normal Form (BCNF) Boyce-Codd normal form (BCNF) A relation is in BCNF, if and only if, every determinant is a candidate key. The difference between 3NF and BCNF is that for a functional dependency A  B, 3NF allows this dependency in a relation if B is a primary-key attribute and A is not a candidate key, whereas BCNF insists that for this dependency to remain in a relation, A must be a candidate key.
  • 22. ClientInterview CClliieennttNN oo iinntteerrvviieewwDDaattee iinntteerrvviieewwTTiimmee ssttaaffffNNoo rroooommNNoo CCRR7766 1133--MMaayy--0022 1100..3300 SSGG55 GG110011 CCRR7766 1133--MMaayy--0022 1122..0000 SSGG55 GG110011 CCRR7744 1133--MMaayy--0022 1122..0000 SSGG3377 GG110022 CCRR5566 11--JJuull--0022 1100..3300 SSGG55 GG110022 • FD1 clientNo, interviewDate  interviewTime, staffNo, roomNo (Primary Key) • FD2 staffNo, interviewDate, interviewTime clientNo (Candidate key) • FD3 roomNo, interviewDate, interviewTime  clientNo, staffNo (Candidate key) • FD4 staffNo, interviewDate  roomNo (not a candidate key) • As a consequece the ClientInterview relation may suffer from update anmalies. • For example, two tuples have to be updated if the roomNo need be changed for staffNo SG5 on the 13-May-02.
  • 23. Example of BCNF(2) To transform the ClientInterview relation to BCNF, we must remove the violating functional dependency by creating two new relations called Interview and StaffRoom as shown below, Interview (clientNo, interviewDate, interviewTime, staffNo) StaffRoom(staffNo, interviewDate, roomNo) Interview CClliieennttNNoo iinntteerrvviieewwDDaattee iinntteerrvviieewwTTiimmee ssttaaffffNNoo CCRR7766 1133--MMaayy--0022 1100..3300 SSGG55 CCRR7766 1133--MMaayy--0022 1122..0000 SSGG55 CCRR7744 1133--MMaayy--0022 1122..0000 SSGG3377 CCRR5566 11--JJuull--0022 1100..3300 SSGG55 StaffRoom ssttaaffffNNoo iinntteerrvviieewwDDaattee rroooommNNoo SSGG55 1133--MMaayy--0022 GG110011 SSGG3377 1133--MMaayy--0022 GG110022 SSGG55 11--JJuull--0022 GG110022 BCNF Interview and StaffRoom relations