SlideShare une entreprise Scribd logo
1  sur  15
Chapter 8: Relational Database 
Design
Combine Schemas? 
 Suppose we combine instructor and department into inst_dept 
 (No connection to relationship set inst_dept) 
 Result is possible repetition of information
Normalization 
 Database Normalisation is a technique of organizing the data in the 
database. Normalization is a systematic approach of decomposing 
tables to eliminate data redundancy and undesirable characteristics 
like Insertion, Update and Deletion Anomalies. 
 It is a multi-step process that puts data into tabular form by removing 
duplicated data from the relation tables. 
 Normalization is used for mainly two purpose, 
 Eliminating reduntant(useless) data. 
 Ensuring data dependencies make sense i.e data is logically 
stored.
Problem Without Normalization 
 Without Normalization, it becomes difficult to handle and update the 
database, without facing data loss. Insertion, Updation and Deletion 
Anomalies are very frequent if database is not Normalized. 
 To understand these anomalies let us take an example of Student 
table.
Problem Without Normalization 
 Updating Anomaly : 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. 
 Insertion Anomaly : Suppose for a new admission, we have a 
Student id(S_id), name and address of a student but if student has not 
opted for any subjects yet then we have to insert NULL there, leading 
to Insertion Anamoly. 
 Deletion Anomaly : If (S_id) 401 has only one subject and 
temporarily he drops it, when we delete that row, entire student record 
will be deleted along with it.
Normalization Techniques 
 Normalization rule are divided into following normal form. 
 First Normal Form (1NF) 
 Second Normal Form (2NF) 
 Third Normal Form (3NF) 
 BCNF 
Atomic: 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. 
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
First Normal Form (Cont.) 
 A relational schema R is in first normal form if the domains of all 
attributes of R are atomic. 
 As per First Normal Form, no two Rows of data must contain repeating 
group of information i.e each set of column must have a unique value, 
such that multiple columns cannot be used to fetch the same row. 
 Each table should be organized into rows, and each row should have a 
primary key that distinguishes it as unique. 
 The Primary key is usually a single column, but sometimes more than 
one column can be combined to create a single primary key.
First Normal Form (Cont.) 
 For example consider a table which is not in First normal form. 
 In First Normal Form, any row must not have a column in which more 
than one value is saved, like separated with commas. Rather than that, 
we must separate such data into multiple rows.
First Normal Form (Cont.) 
 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 
 Remove subsets of data that apply to multiple rows of a table and place 
them in separate tables. 
 Create relationships between these new tables and their predecessors 
through the use of foreign keys. 
 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. 
First 
Name 
Las t 
Name 
Address City State Zip 
Lisa Hestings Bertha 
Street 
Miami FL 33157 
Adam Gabriel Fleming 
Street 
Miami FL 33157 
Lucy Herts Bridge 
Road 
NY Sea Cliff 11579
Second Normal Form 
 A brief look at this table reveals a small amount of redundant data. 
We're storing the Sea Cliff, NY 11579 and Miami, FL 33157 
entries twice each. 
 Additionally, if the ZIP code for FL were to change, we'd need to 
make that change in many places throughout the database. 
 In a 2NF-compliant database structure, this redundant information 
is extracted and stored in a separate table. Our new table (let's call 
it ZIPs) might have the following columns- 
Zip City State 
 We’ll need to use a foreign key to tie the two tables together. 
We'll use the ZIP code (the primary key from the ZIPs table) to 
create that relationship. Here's our new Customers table: 
First Name Las t 
Name 
Address Zip
Third Normal Form 
 Third Normal form applies that every non-prime attribute of table must 
be dependent on primary key. 
 The transitive functional dependency should be removed from the table. 
The table must be in Second Normal form. For example, consider a 
table with following fields. 
Order No Customer No Unit 
Price 
Quantity Total 
123J09 NY65031 500 $ 2 1000 $ 
120J11 ST90452 300 $ 1 300 $ 
123J09 NY65031 100 $ 4 400 $ 
 Now, are all of the columns fully dependent upon the primary key? 
 The customer number varies with the order number and it doesn't 
appear to depend upon any of the other fields. 
 It appears sometimes charge the same customer different prices. The 
quantity of items also varies from order to order. So, the unit price and 
quamtity is fully dependent upon the order number.
Third Normal Form 
 What about the total? 
 The total can be derived by multiplying the unit price by the quantity, 
therefore it's not fully dependent upon the primary key. We must 
remove it from the table to comply with the third normal form. 
Order No Customer 
No 
Price 
Price Unit Price Quantity Total
Boyce-Codd Normal Form 
Boyce and Codd Normal Form is a higher version of the 
Third Normal form. 
This form deals with certain type of anomaly that is not handled 
by 3NF. 
A 3NF table which does not have multiple overlapping candidate 
keys is said to be in BCNF.
Thank you

Contenu connexe

Tendances

Introduction to Database Concepts
Introduction to Database ConceptsIntroduction to Database Concepts
Introduction to Database Concepts
Rosalyn Lemieux
 
Database Relationships
Database RelationshipsDatabase Relationships
Database Relationships
wmassie
 
Normalisation - 2nd normal form
Normalisation - 2nd normal formNormalisation - 2nd normal form
Normalisation - 2nd normal form
college
 

Tendances (19)

Database intro
Database introDatabase intro
Database intro
 
Intro To DataBase
Intro To DataBaseIntro To DataBase
Intro To DataBase
 
Dbms ppt
Dbms pptDbms ppt
Dbms ppt
 
Introduction to Database Concepts
Introduction to Database ConceptsIntroduction to Database Concepts
Introduction to Database Concepts
 
Intro databases (Table, Record, Field)
Intro databases (Table, Record, Field)Intro databases (Table, Record, Field)
Intro databases (Table, Record, Field)
 
RDBMS
RDBMSRDBMS
RDBMS
 
Understanding about relational database m-square systems inc
Understanding about relational database m-square systems incUnderstanding about relational database m-square systems inc
Understanding about relational database m-square systems inc
 
Database Basics Theory
Database Basics TheoryDatabase Basics Theory
Database Basics Theory
 
Research gadot
Research gadotResearch gadot
Research gadot
 
Database Relationships
Database RelationshipsDatabase Relationships
Database Relationships
 
Database Management
Database ManagementDatabase Management
Database Management
 
Normalization Accepted
Normalization AcceptedNormalization Accepted
Normalization Accepted
 
Normalisation - 2nd normal form
Normalisation - 2nd normal formNormalisation - 2nd normal form
Normalisation - 2nd normal form
 
Data Dictionary
Data DictionaryData Dictionary
Data Dictionary
 
RDBMS
RDBMSRDBMS
RDBMS
 
RDBMS concepts
RDBMS conceptsRDBMS concepts
RDBMS concepts
 
Data processing
Data processingData processing
Data processing
 
Week 1 Before the Advent of Database Systems & Fundamental Concepts
Week 1 Before the Advent of Database Systems & Fundamental ConceptsWeek 1 Before the Advent of Database Systems & Fundamental Concepts
Week 1 Before the Advent of Database Systems & Fundamental Concepts
 
12 SQL
12 SQL12 SQL
12 SQL
 

En vedette (10)

Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
 
Arrays in CPP
Arrays in CPPArrays in CPP
Arrays in CPP
 
Computer processing
Computer processingComputer processing
Computer processing
 
String operation
String operationString operation
String operation
 
Arrays
ArraysArrays
Arrays
 
Merge sort and quick sort
Merge sort and quick sortMerge sort and quick sort
Merge sort and quick sort
 
How to Draw an Effective ER diagram
How to Draw an Effective ER diagramHow to Draw an Effective ER diagram
How to Draw an Effective ER diagram
 
SQL : introduction
SQL : introductionSQL : introduction
SQL : introduction
 
Erd examples
Erd examplesErd examples
Erd examples
 
Entity relationship diagram (erd)
Entity relationship diagram (erd)Entity relationship diagram (erd)
Entity relationship diagram (erd)
 

Similaire à Normalization

What is Database NormalizationExplain the guidelines for ensuring t.pdf
What is Database NormalizationExplain the guidelines for ensuring t.pdfWhat is Database NormalizationExplain the guidelines for ensuring t.pdf
What is Database NormalizationExplain the guidelines for ensuring t.pdf
arjunstores123
 

Similaire à Normalization (20)

What is Database NormalizationExplain the guidelines for ensuring t.pdf
What is Database NormalizationExplain the guidelines for ensuring t.pdfWhat is Database NormalizationExplain the guidelines for ensuring t.pdf
What is Database NormalizationExplain the guidelines for ensuring t.pdf
 
Normalization
NormalizationNormalization
Normalization
 
Assignment#11
Assignment#11Assignment#11
Assignment#11
 
Database normalization
Database normalizationDatabase normalization
Database normalization
 
T-SQL Overview
T-SQL OverviewT-SQL Overview
T-SQL Overview
 
Lecture 6.pptx
Lecture 6.pptxLecture 6.pptx
Lecture 6.pptx
 
Normalization.ppt
Normalization.pptNormalization.ppt
Normalization.ppt
 
Normalization in Database
Normalization in DatabaseNormalization in Database
Normalization in Database
 
Database design normalization note and exercise
Database design normalization note and exerciseDatabase design normalization note and exercise
Database design normalization note and exercise
 
normaliztion
normaliztionnormaliztion
normaliztion
 
Year 11 DATA PROCESSING 1st Term
Year 11 DATA PROCESSING 1st TermYear 11 DATA PROCESSING 1st Term
Year 11 DATA PROCESSING 1st Term
 
DBMS (UNIT 2)
DBMS (UNIT 2)DBMS (UNIT 2)
DBMS (UNIT 2)
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database Design
 
Data normailazation
Data normailazationData normailazation
Data normailazation
 
Data tidying with tidyr meetup
Data tidying with tidyr  meetupData tidying with tidyr  meetup
Data tidying with tidyr meetup
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Normal forms
Normal formsNormal forms
Normal forms
 
Database Normalization.docx
Database Normalization.docxDatabase Normalization.docx
Database Normalization.docx
 
Jai dbms
Jai dbmsJai dbms
Jai dbms
 
DBMS (1).pptx
DBMS (1).pptxDBMS (1).pptx
DBMS (1).pptx
 

Plus de Shakila Mahjabin (7)

CSC 433 Sample normalization SQL Question
CSC 433 Sample normalization SQL QuestionCSC 433 Sample normalization SQL Question
CSC 433 Sample normalization SQL Question
 
Solution of Erds
Solution of ErdsSolution of Erds
Solution of Erds
 
Stack and queue
Stack and queueStack and queue
Stack and queue
 
Algo analysis
Algo analysisAlgo analysis
Algo analysis
 
Codes on structures
Codes on structuresCodes on structures
Codes on structures
 
array, function, pointer, pattern matching
array, function, pointer, pattern matchingarray, function, pointer, pattern matching
array, function, pointer, pattern matching
 
Data Structure Basics
Data Structure BasicsData Structure Basics
Data Structure Basics
 

Dernier

Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 

Dernier (20)

Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 

Normalization

  • 1. Chapter 8: Relational Database Design
  • 2. Combine Schemas? Suppose we combine instructor and department into inst_dept (No connection to relationship set inst_dept) Result is possible repetition of information
  • 3. Normalization Database Normalisation is a technique of organizing the data in the database. Normalization is a systematic approach of decomposing tables to eliminate data redundancy and undesirable characteristics like Insertion, Update and Deletion Anomalies. It is a multi-step process that puts data into tabular form by removing duplicated data from the relation tables. Normalization is used for mainly two purpose, Eliminating reduntant(useless) data. Ensuring data dependencies make sense i.e data is logically stored.
  • 4. Problem Without Normalization Without Normalization, it becomes difficult to handle and update the database, without facing data loss. Insertion, Updation and Deletion Anomalies are very frequent if database is not Normalized. To understand these anomalies let us take an example of Student table.
  • 5. Problem Without Normalization Updating Anomaly : 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. Insertion Anomaly : Suppose for a new admission, we have a Student id(S_id), name and address of a student but if student has not opted for any subjects yet then we have to insert NULL there, leading to Insertion Anamoly. Deletion Anomaly : If (S_id) 401 has only one subject and temporarily he drops it, when we delete that row, entire student record will be deleted along with it.
  • 6. Normalization Techniques Normalization rule are divided into following normal form. First Normal Form (1NF) Second Normal Form (2NF) Third Normal Form (3NF) BCNF Atomic: 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. 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
  • 7. First Normal Form (Cont.) A relational schema R is in first normal form if the domains of all attributes of R are atomic. As per First Normal Form, no two Rows of data must contain repeating group of information i.e each set of column must have a unique value, such that multiple columns cannot be used to fetch the same row. Each table should be organized into rows, and each row should have a primary key that distinguishes it as unique. The Primary key is usually a single column, but sometimes more than one column can be combined to create a single primary key.
  • 8. First Normal Form (Cont.) For example consider a table which is not in First normal form. In First Normal Form, any row must not have a column in which more than one value is saved, like separated with commas. Rather than that, we must separate such data into multiple rows.
  • 9. First Normal Form (Cont.) 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.
  • 10. Second Normal Form Remove subsets of data that apply to multiple rows of a table and place them in separate tables. Create relationships between these new tables and their predecessors through the use of foreign keys. 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. First Name Las t Name Address City State Zip Lisa Hestings Bertha Street Miami FL 33157 Adam Gabriel Fleming Street Miami FL 33157 Lucy Herts Bridge Road NY Sea Cliff 11579
  • 11. Second Normal Form A brief look at this table reveals a small amount of redundant data. We're storing the Sea Cliff, NY 11579 and Miami, FL 33157 entries twice each. Additionally, if the ZIP code for FL were to change, we'd need to make that change in many places throughout the database. In a 2NF-compliant database structure, this redundant information is extracted and stored in a separate table. Our new table (let's call it ZIPs) might have the following columns- Zip City State We’ll need to use a foreign key to tie the two tables together. We'll use the ZIP code (the primary key from the ZIPs table) to create that relationship. Here's our new Customers table: First Name Las t Name Address Zip
  • 12. Third Normal Form Third Normal form applies that every non-prime attribute of table must be dependent on primary key. The transitive functional dependency should be removed from the table. The table must be in Second Normal form. For example, consider a table with following fields. Order No Customer No Unit Price Quantity Total 123J09 NY65031 500 $ 2 1000 $ 120J11 ST90452 300 $ 1 300 $ 123J09 NY65031 100 $ 4 400 $ Now, are all of the columns fully dependent upon the primary key? The customer number varies with the order number and it doesn't appear to depend upon any of the other fields. It appears sometimes charge the same customer different prices. The quantity of items also varies from order to order. So, the unit price and quamtity is fully dependent upon the order number.
  • 13. Third Normal Form What about the total? The total can be derived by multiplying the unit price by the quantity, therefore it's not fully dependent upon the primary key. We must remove it from the table to comply with the third normal form. Order No Customer No Price Price Unit Price Quantity Total
  • 14. Boyce-Codd Normal Form Boyce and Codd Normal Form is a higher version of the Third Normal form. This form deals with certain type of anomaly that is not handled by 3NF. A 3NF table which does not have multiple overlapping candidate keys is said to be in BCNF.