SlideShare a Scribd company logo
1 of 19
UNIT -3
Normal Forms
First normal form (1 NF)
Rules:
• Eliminate repeating groups in individual tables.
• Create a separate table for each set of related data.
• Identify each set of related data with a primary key.
• Do not use multiple fields in a single table to store similar data.
Example: Relation EMPLOYEE is not in 1NF because of multi-valued
attribute EMP_PHONE.
• EMPLOYEE table:
EMP_ID EMP_NAME EMP_PHONE EMP_STATE1 EMP_STATE2
14 John 7272826385,
9064738238
UP UP
20 Harry 8574783832 Bihar
12 Sam 7390372389,
8589830302
Punjab Punjab
EMP_ID EMP_NAME EMP_PHONE EMP_STATE#
14 John 7272826385 UP
14 John 9064738238 UP
20 Harry 8574783832 Bihar
12 Sam 7390372389 Punjab
12 Sam 8589830302 Punjab
Ex2:
ID Name Courses
1 A C1 ,C2
2 E C3
3 M C2 , C3
Second normal form
• It exists in 1NF
• In the second normal form, all non-key attributes are fully
functional dependent on the primary key.
• Create separate tables for sets of values that apply to
multiple records.
• no Partial Dependency
TEACHER table
TEACHER_ID SUBJECT TEACHER_AGE
25 Chemistry 30
25 Biology 30
47 English 35
83 Math 38
83 Computer 38
TEACHER_ID TEACHER_AGE
25 30
47 35
83 38
TEACHER_ID SUBJECT
25 Chemistry
25 Biology
47 English
83 Math
83 Computer
Ex 2:<StudentProject>
StudentID ProjectID StudentName ProjectName
S89 P09 Olivia Geo Location
S76 P07 Jacob Cluster
Exploration
S56 P03 Ava IoT Devices
S92 P05 Alexandra Cloud
Deployment
StudentID ProjectID StudentName
S89 P09 Olivia
S76 P07 Jacob
S56 P03 Ava
S92 P05 Alexandra
ProjectID ProjectName
P09 Geo Location
P07 Cluster Exploration
P03 IoT Devices
P05 Cloud Deployment
Third Normal Form (3NF)
• It should be in second normal form.
• A relation is in third normal form, if there is no
transitive dependency for non-prime
attributes.
• 3NF is used to reduce the data duplication.
EMP_ID EMP_NAME EMP_ZIP EMP_STATE EMP_CITY
222 Harry 201010 UP Noida
333 Stephan 02228 US Boston
444 Lan 60007 US Chicago
555 Katharine 06389 UK Norwich
666 John 462007 MP Bhopal
• Super key :
• {EMP_ID}, {EMP_ID, EMP_NAME}, {EMP_ID, EMP_NAME, E
MP_ZIP}
• Non-prime attributes: In the given table, all attributes
except EMP_ID are non-prime.
• EMP_STATE & EMP_CITY EMP_ZIP & EMP_ZIP EMP_ID.
• The non-prime attributes (EMP_STATE, EMP_CITY)
transitively dependent on super key(EMP_ID). It violates
the rule of third normal form.
• That's why we need to move the EMP_CITY and EMP_STATE
to the new <EMPLOYEE_ZIP> table, with EMP_ZIP as a
Primary key.
EMP_ID EMP_NAME EMP_ZIP
222 Harry 201010
333 Stephan 02228
444 Lan 60007
555 Katharine 06389
666 John 462007
EMP_ZIP EMP_STATE EMP_CITY
201010 UP Noida
02228 US Boston
60007 US Chicago
06389 UK Norwich
462007 MP Bhopal
Ex2:
ID NAME SUBJECT STATE COUNTRY
29 Lalita English Gujrat INDIA
33 Ramesh Geography Punjab INDIA
49 Sarita Mathematics Maharashtra INDIA
78 Zayed History Bihar INDIA
The F.D set { ID->NAME, NAME->SUBJECT,
NAME->STATE, STATE->COUNTRY}
ID STATE COUNTRY
29 Gujrat INDIA
33 Punjab INDIA
49 Maharashtra INDIA
78 Bihar INDIA
ID NAME SUBJECT
29 Lalita English
33 Ramesh Geography
49 Sarita Mathematics
78 Zayed History
BCNF
Rules:
• It should be in the Third Normal Form.
• And, for any dependency A → B, A should be
a key.
• In BCNF as in the functional dependencies left
side part is a key.
Ex:
F.D:
emp_id -> emp_nationality
emp_dept -> {dept_type, dept_no_of_emp}
emp_id emp_nationality emp_dept dept_type No_of_emp
1001 Austrian
Production and
planning
D001 200
1001 Austrian stores D001 250
1002 American
design and
technical
support
D134 100
1002 American
Purchasing
department
D134 600
emp_id emp_nationality
1001 Austrian
1002 American
emp_dept dept_type dept_no_of_emp
Production and
planning
D001 200
stores D001 250
design and technical
support
D134 100
Purchasing
department
D134 600
emp_id emp_dept
1001 Production and planning
1001 stores
1002 design and technical support
1002 Purchasing department
Ex 2: BCNF
• A table where student is opted more than one
subject .
stud_id stud_nationality stud_subject dept_type sub_code
1001 Indian ECE SCIENCE 200
1002 American GEOGRAPHY ENVIRONMENTAL 250
1002 American CSE SCIENCE 280
1001 Indian ANTHROPOLOGY ENVIRONMENTAL 300
1: Identify Functional dependencies in the table
above
2: Identify Candidate key
Candidate key: {stud_id, stud_subject}
3. decompose it into three tables and map
stud_id -> stud_nationality
stud_subject -> {dept_type, sub_code}
After decomposition:
stud_id stud_nationality
1001 Indian
1002 American
stud_subject dept_type sub_code
ECE SCIENCE 200
GEOGRAPHY ENVIRONMENTAL 250
CSE
SCIENCE
280
ANTHROPOLOGY
ENVIRONMENTAL 300
stud_id stud_subject
1001 GEOGRAPHY
1002 stores
1002 CSE
1002 ANTHROPOLOGY
Candidate keys:
For first table: stud_id
For second table: stud_subject
For third table: {stud_id, stud_subject}

More Related Content

Similar to UNIT -3.pptx (6)

Kumar lav
Kumar lavKumar lav
Kumar lav
 
functional dependencies with example
functional dependencies with examplefunctional dependencies with example
functional dependencies with example
 
Sap abap-data structures and internal tables
Sap abap-data structures and internal tablesSap abap-data structures and internal tables
Sap abap-data structures and internal tables
 
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
 
Normalization_BCA_
Normalization_BCA_Normalization_BCA_
Normalization_BCA_
 
Chapter+3+-+Normalization.pdf
Chapter+3+-+Normalization.pdfChapter+3+-+Normalization.pdf
Chapter+3+-+Normalization.pdf
 

Recently uploaded

Final DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manualFinal DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manual
BalamuruganV28
 
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
drjose256
 
1893-part-1-2016 for Earthquake load design
1893-part-1-2016 for Earthquake load design1893-part-1-2016 for Earthquake load design
1893-part-1-2016 for Earthquake load design
AshishSingh1301
 
Online crime reporting system project.pdf
Online crime reporting system project.pdfOnline crime reporting system project.pdf
Online crime reporting system project.pdf
Kamal Acharya
 
21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx
rahulmanepalli02
 

Recently uploaded (20)

5G and 6G refer to generations of mobile network technology, each representin...
5G and 6G refer to generations of mobile network technology, each representin...5G and 6G refer to generations of mobile network technology, each representin...
5G and 6G refer to generations of mobile network technology, each representin...
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
 
Interfacing Analog to Digital Data Converters ee3404.pdf
Interfacing Analog to Digital Data Converters ee3404.pdfInterfacing Analog to Digital Data Converters ee3404.pdf
Interfacing Analog to Digital Data Converters ee3404.pdf
 
Final DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manualFinal DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manual
 
Passive Air Cooling System and Solar Water Heater.ppt
Passive Air Cooling System and Solar Water Heater.pptPassive Air Cooling System and Solar Water Heater.ppt
Passive Air Cooling System and Solar Water Heater.ppt
 
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
 
Raashid final report on Embedded Systems
Raashid final report on Embedded SystemsRaashid final report on Embedded Systems
Raashid final report on Embedded Systems
 
Introduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AIIntroduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AI
 
Insurance management system project report.pdf
Insurance management system project report.pdfInsurance management system project report.pdf
Insurance management system project report.pdf
 
Autodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptxAutodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptx
 
1893-part-1-2016 for Earthquake load design
1893-part-1-2016 for Earthquake load design1893-part-1-2016 for Earthquake load design
1893-part-1-2016 for Earthquake load design
 
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdfInvolute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
 
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisSeismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
 
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
 
Online crime reporting system project.pdf
Online crime reporting system project.pdfOnline crime reporting system project.pdf
Online crime reporting system project.pdf
 
UNIT-2 image enhancement.pdf Image Processing Unit 2 AKTU
UNIT-2 image enhancement.pdf Image Processing Unit 2 AKTUUNIT-2 image enhancement.pdf Image Processing Unit 2 AKTU
UNIT-2 image enhancement.pdf Image Processing Unit 2 AKTU
 
Vip ℂall Girls Karkardooma Phone No 9999965857 High Profile ℂall Girl Delhi N...
Vip ℂall Girls Karkardooma Phone No 9999965857 High Profile ℂall Girl Delhi N...Vip ℂall Girls Karkardooma Phone No 9999965857 High Profile ℂall Girl Delhi N...
Vip ℂall Girls Karkardooma Phone No 9999965857 High Profile ℂall Girl Delhi N...
 
Multivibrator and its types defination and usges.pptx
Multivibrator and its types defination and usges.pptxMultivibrator and its types defination and usges.pptx
Multivibrator and its types defination and usges.pptx
 
Worksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxWorksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptx
 
21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx
 

UNIT -3.pptx

  • 2. First normal form (1 NF) Rules: • Eliminate repeating groups in individual tables. • Create a separate table for each set of related data. • Identify each set of related data with a primary key. • Do not use multiple fields in a single table to store similar data. Example: Relation EMPLOYEE is not in 1NF because of multi-valued attribute EMP_PHONE. • EMPLOYEE table: EMP_ID EMP_NAME EMP_PHONE EMP_STATE1 EMP_STATE2 14 John 7272826385, 9064738238 UP UP 20 Harry 8574783832 Bihar 12 Sam 7390372389, 8589830302 Punjab Punjab
  • 3. EMP_ID EMP_NAME EMP_PHONE EMP_STATE# 14 John 7272826385 UP 14 John 9064738238 UP 20 Harry 8574783832 Bihar 12 Sam 7390372389 Punjab 12 Sam 8589830302 Punjab
  • 4. Ex2: ID Name Courses 1 A C1 ,C2 2 E C3 3 M C2 , C3
  • 5. Second normal form • It exists in 1NF • In the second normal form, all non-key attributes are fully functional dependent on the primary key. • Create separate tables for sets of values that apply to multiple records. • no Partial Dependency TEACHER table TEACHER_ID SUBJECT TEACHER_AGE 25 Chemistry 30 25 Biology 30 47 English 35 83 Math 38 83 Computer 38
  • 6. TEACHER_ID TEACHER_AGE 25 30 47 35 83 38 TEACHER_ID SUBJECT 25 Chemistry 25 Biology 47 English 83 Math 83 Computer
  • 7. Ex 2:<StudentProject> StudentID ProjectID StudentName ProjectName S89 P09 Olivia Geo Location S76 P07 Jacob Cluster Exploration S56 P03 Ava IoT Devices S92 P05 Alexandra Cloud Deployment
  • 8. StudentID ProjectID StudentName S89 P09 Olivia S76 P07 Jacob S56 P03 Ava S92 P05 Alexandra ProjectID ProjectName P09 Geo Location P07 Cluster Exploration P03 IoT Devices P05 Cloud Deployment
  • 9. Third Normal Form (3NF) • It should be in second normal form. • A relation is in third normal form, if there is no transitive dependency for non-prime attributes. • 3NF is used to reduce the data duplication. EMP_ID EMP_NAME EMP_ZIP EMP_STATE EMP_CITY 222 Harry 201010 UP Noida 333 Stephan 02228 US Boston 444 Lan 60007 US Chicago 555 Katharine 06389 UK Norwich 666 John 462007 MP Bhopal
  • 10. • Super key : • {EMP_ID}, {EMP_ID, EMP_NAME}, {EMP_ID, EMP_NAME, E MP_ZIP} • Non-prime attributes: In the given table, all attributes except EMP_ID are non-prime. • EMP_STATE & EMP_CITY EMP_ZIP & EMP_ZIP EMP_ID. • The non-prime attributes (EMP_STATE, EMP_CITY) transitively dependent on super key(EMP_ID). It violates the rule of third normal form. • That's why we need to move the EMP_CITY and EMP_STATE to the new <EMPLOYEE_ZIP> table, with EMP_ZIP as a Primary key.
  • 11. EMP_ID EMP_NAME EMP_ZIP 222 Harry 201010 333 Stephan 02228 444 Lan 60007 555 Katharine 06389 666 John 462007 EMP_ZIP EMP_STATE EMP_CITY 201010 UP Noida 02228 US Boston 60007 US Chicago 06389 UK Norwich 462007 MP Bhopal
  • 12. Ex2: ID NAME SUBJECT STATE COUNTRY 29 Lalita English Gujrat INDIA 33 Ramesh Geography Punjab INDIA 49 Sarita Mathematics Maharashtra INDIA 78 Zayed History Bihar INDIA The F.D set { ID->NAME, NAME->SUBJECT, NAME->STATE, STATE->COUNTRY}
  • 13. ID STATE COUNTRY 29 Gujrat INDIA 33 Punjab INDIA 49 Maharashtra INDIA 78 Bihar INDIA ID NAME SUBJECT 29 Lalita English 33 Ramesh Geography 49 Sarita Mathematics 78 Zayed History
  • 14. BCNF Rules: • It should be in the Third Normal Form. • And, for any dependency A → B, A should be a key. • In BCNF as in the functional dependencies left side part is a key.
  • 15. Ex: F.D: emp_id -> emp_nationality emp_dept -> {dept_type, dept_no_of_emp} emp_id emp_nationality emp_dept dept_type No_of_emp 1001 Austrian Production and planning D001 200 1001 Austrian stores D001 250 1002 American design and technical support D134 100 1002 American Purchasing department D134 600
  • 16. emp_id emp_nationality 1001 Austrian 1002 American emp_dept dept_type dept_no_of_emp Production and planning D001 200 stores D001 250 design and technical support D134 100 Purchasing department D134 600 emp_id emp_dept 1001 Production and planning 1001 stores 1002 design and technical support 1002 Purchasing department
  • 17. Ex 2: BCNF • A table where student is opted more than one subject . stud_id stud_nationality stud_subject dept_type sub_code 1001 Indian ECE SCIENCE 200 1002 American GEOGRAPHY ENVIRONMENTAL 250 1002 American CSE SCIENCE 280 1001 Indian ANTHROPOLOGY ENVIRONMENTAL 300
  • 18. 1: Identify Functional dependencies in the table above 2: Identify Candidate key Candidate key: {stud_id, stud_subject} 3. decompose it into three tables and map stud_id -> stud_nationality stud_subject -> {dept_type, sub_code}
  • 19. After decomposition: stud_id stud_nationality 1001 Indian 1002 American stud_subject dept_type sub_code ECE SCIENCE 200 GEOGRAPHY ENVIRONMENTAL 250 CSE SCIENCE 280 ANTHROPOLOGY ENVIRONMENTAL 300 stud_id stud_subject 1001 GEOGRAPHY 1002 stores 1002 CSE 1002 ANTHROPOLOGY Candidate keys: For first table: stud_id For second table: stud_subject For third table: {stud_id, stud_subject}