SlideShare a Scribd company logo
1 of 20
Normalization
February 2017
Business Economics & Information Technology
Roxana Tadayon
OUTLINE
◼Normalization
◼Anomalies
◼Functional Dependency
◼First Normal Form
◼Second Normal Form
◼Third Normal Form 2
Normalization
 Normalization is the process of organizing data to minimize data redundancy (data duplication)
 If same piece of information is stored more than once, it is called redundant information
 The goal of normalization is to decompose relations with anomalies in order to produce smaller and well-
structured tables
 Normalization theory is based on functional dependencies
 The most commonly used normal forms: First normal form(1NF), Second normal form(2NF), Third normal
form(3NF)
.
3
ID Name Gende
r
Age DOB Street City Zip_Code Department_ID Department_Name
Department
Location
1000 Rasmus
Jensen
M 27 28-05-1990 strandvej 112 Hellerup 2910 098 BE-IT Lygten 16
Copenhagen
2400
1001 Sara
Victoria
F 19 07-10-1996 Løvstikkevej
500, st.
København S 2300 101 Multimedia design Lygten 16
DK 2400
Copenhagen
1003 Jens
Rasmusen
M 20 09-10-97 Langkærvej
22
København S 2300 098 BE-IT Lygten 16
DK 2400
Copenhagen
Anomalies
• Database anomalies refer to errors and inconsistencies in the database
• Anomalies have a negative effect on the process of inserting, deleting and modifying data
in the tables
 It is important to remove these anomalies in order to perform different processing on the
tables without any problem
◼ http://slideplayer.com/slide/9705202/
4
ID Name Gender Age DOB Street City Zip_Code
Departme
nt_ID
Department_Nma
e
Department
Location
1000 Rasmus
Jensen
M 27 28-05-1990 strandvej 112 Hellerup 2910 098 BE-IT Lygten 16
DK 2400
Copenhagen
1001 Sara
Victoria
F 19 07-10-1996 Løvstikkevej 500, st. Københ
avn S
2300 101 Multimedia
design
Lygten 16
DK 2400
Copenhagen
1003 Jens
Rasmusen
M 20 09-10-97 Langkærvej
22
Københ
avn S
2300 098 BE-IT Lygten 16
DK 2400
Copenhagen
Functional Dependency
5
 An FD is a relationship between an attribute "Y" and a determinant (1 or more other attributes) "X"
such that for a given value of a determinant the value of the attribute is uniquely defined.
(written X → Y) if, and only if, each X value is associated with exactly one Y value
X → Y
X is a determinant
X determines Y
Y is functionally dependent on X
Student_ ID Student_Name
1000 Rasmus Jensen
1001 Sara Victoria
1003 Jens Rasmusen
1004 Sara Victoria
1001 Rasmus Jesnsen
Student_ID Student_Name
Example: Student_ID determines Student_Name (or
Student_Name depends on Student_ID)
Each student has exactly one name, but the name could
be the name of many students. So Name does not
determine Student_ID
1005
Is student_name functionally
dependent on Student_ID?
First Normal Form
◼A table is said to be in First Normal Form (1NF) if
1. the data in each column be atomic. No multiple values, separated by comma
2. the table does not contain any repeating column groups
3. Identify each record uniquely using primary key
6
Department _Name Student_Name
BE_IT Rasums, Jens , Kim
Multimedia design Sara
It is not possible to INSERT, UPDATE, and DELETE
just one student
Department
_Name
Student_Name
BEIT Rasmus
BEIT Jens
BEIT Kim
Multimedia
design
Sara
Department
_Name
Student_Name1 Student_Name2 Student_Name3
BE_IT Rasmus Jens Kim
Multimedia
design
Sara
Student_ID
1000
1000
1001
1001
Exercise A (1NF)
7
Convert the following table into the first NormalForm
Product_Id Product_Name Category Price_1 Price_2 Price_3
200 Table Classic, Glas 708,67 800 932,50
205 Chair Modern, Wood 553,56 475,99
Exercise B(1NF)
8
Studentname ZIP_Code Town Course1 Course2 Course3 Course4 Course5 Course6 Course7
Mark Owen 02474 ARLINGTON English German
Mathematic
s Chemistry Gymnastics
Ann Owen 02201 BOSTON English
Mathematic
s Physics Gymnastics
Bill Gates 02474 ARLINGTON English German
Mathematic
s Chemistry Gymnastics Computing
Mark Owen 02201 BOSTON English German Design
Mathematic
s Chemistry Gymnastics Zen
Convert this table into the first NormalForm
Second normal form(2NF)
9
Is a table with a single primary key in 2NF?
A table is in 2NF if it is in 1NF and every non-primary key
(non-prime) attribute is fully functionally dependent on
the primary key (and not on a set of primary
keys/Composite Key )
If a table is not in 2NF, we will divide it into separate
tables (DECOMPOSE) each in 2NF by ensuring that
the primary key of each new relation functionally
determines all the attributes
Find out the non key fields which do not depend on
the whole primary key (partial functional dependency
column) and then place them in a separate table with
a copy of the primary key
Is not in second normal form
In second normal form
In second normal form
Decomposition-2NF
10
Lecture
r_ID
Lecturer_Name Gen
der
DOB Department_I
D
Department_N
ame
Street City Zip_Code
Head of
Department
100 Jesper
Frederiksen
M NULL 022 BEIT Lygten 16 København 2400 Ola Pukkii
101 Lars Thomasen M 09-10-1955 053 Datamatiker Lygten 37 København 2400 Annette Havkær
102 Kim juhl M NULL 022 BEIT Lygten 16 København 2400 Ola
Pukkii
103 Jens Rasmusen M 29-12-80 053 Datamatiker Lygten 37 København 2400 Annette Havkær
104 Tina Jensen F 15-03-1965 008 Design Guldbergsgade 29N København 2200 Mette
Harrestrup
Decomposition-2NF
11
Lecturer_ID Lecturer_Name Gender DOB
100 Jesper Frederiksen M NULL
101 Lars Thomasen M 09-10-1955
102 Kim juhl M NULL
103 Jens Rasmusen M 29-12-80
104 Tina Jensen F 15-03-1965
Department_ID Department_Name Street City Zip_Code Head of Department
022 BEIT Lygten 16 København 2400 Ola Pukkii
053 Datamatiker Lygten 37 København 2400 Annette Havkær
008 Design Guldbergsgade 29 København 2200 Mette Harrestrup
Department_ID
022
053
022
053
008
How to Find the Relationship
Between Two Tables?
MANY TO MANY??
Exercise C (2NF)
12
Convert the following table into the second NormalForm
S# STATUS CITY P# QTY
S1 20 London P1 300
S1 20 London P2 200
S1 20 London P3 400
S1 20 London P4 200
S1 20 London P5 100
S1 20 London P6 100
S2 10 Paris P1 300
S2 10 Paris P2 200
S3 10 Paris P2 200
S4 20 London P2 200
S4 20 London P4 200
S4 20 London P5 100
Exercise D (2NF)
13
Provider ID DiagnonisCode DiagnonisDescrip
tion
ServiceLocationI
D
ServiceCity ServiceState ServiceDate
8472 798 Fever 354 St.Louis MO 20-03-2015
8427 678 Hypertension 278 KirkWood MA 10-03-2015
1928 798 Fever 452 Austin TX 10-09-08
1928 536 Stomach Gas 867 Kyle TX 78-01-02
◼Convert the following table into the second NormalForm
Third normal form(3NF)
14
A table is in 2NF if
I. It is in 1NF
II. All nonprimary fields are dependent
on the primary key OR
Nonprimary key attributes don’t
depend on other nonprimary key
attributes OR
No transitive functional dependencies
between two non-keys attributes
A B (B A)
B C
A C
Example-Third normal form(3NF)
15
Department_ID Department_Name Street City Zip_Code
022 BEIT Lygten 16 København NV 2400
014 Construction Management Guldbergsgade 29 København N 2200
020 Multimedia Lygten 16 København NV 2400
053 Tech Landskronagade 64 København Ø 2100
002 Datamatiker Lygten 37 København NV 2400
008 Design Guldbergsgade 29 København N 2200
A B (B A)
Department_ID City City Department_ID
B C
City Zip_Code
A C
Department_ID Zip_Code
Decomposition-3NF
16
 Decompose tables(s) to eliminate transitive functional dependencies
 Move all columns involved in transitive dependencies to a new table
 Identify a primary key for the new entity.
 Place the primary key for the new table as a foreign key on the original table
Department_ID Department_Name Street
022 BEIT Lygten 16
014 Construction Management Guldbergsgade 29
020 Multimedia Lygten 16
053 Tech Landskronagade 64
002 Datamatiker Lygten 37
008 Design Guldbergsgade 29
City Zip_Code
København NV 2400
København N 2200
København Ø 2100
Zip_Code
2400
2200
2400
2100
2400
2200
All transitive dependencies are
removed to place in another
table
Exercise E (3NF)
17
◼Convert the following table into the third NormalForm
Cutomer_ID Customer_FirstName Customer_LastName Customer_DOB AccNO BankCode Bank
1002 Helle Allamn 09-10-1978 100987654 9090 BOA
1003 Chad Herlof 12-12-1950 100987655 9090 BOA
1004 Ken Rasmusen 01-08-1999 100987656 8920 CAPITA1
1005 Tina Borup 29-06-1970 100987657 8920 CAPITAL1
Exercise F (3NF)
◼Continue normalization (2NF & 3NF) of the tables of
Exercises A & B
18
HAND-IN
19
NAME
CPR
ADDRESS
ZIP_CODE
PHONE
BIRTH_OF_DATE
MARITALSTATUS
GENDER
RACE
SMOKER
DRUG_ABUSE
DRIVINGLICENSNUM
DRIVINGLICENSESTATE
NEAREST RELATIVE
PHONE NUMBER OF NEAREST RELATIVE
INSURANCE NUMBER
INSURANCE NAME
DATE OF INSURANCE COVERAGE
REASON OF HOSPITALIZATION
DATE OF HOSPITALIZATION
Create a patient table with the following information. Normalize the table and then insert information of 5 patients
into the tables. Specify keys, the relationships, and the cardinalities between the tables
Summary
20
FIRST NORMAL FORM
(1NF)
No repeating values and
No repeating groups
Specify primary key
SECOND NORMAL FORM
(2NF)
No non-key values based on
just part of a composite key
Third NORMAL FORM
(3NF)
No non-key values based on
other non-key values
https://www.youtube.com/watch?v=UrYLYV7WSHM

More Related Content

Similar to Normalization

Similar to Normalization (13)

Types of normalization
Types of normalizationTypes of normalization
Types of normalization
 
NORMALIZATION.pptx
NORMALIZATION.pptxNORMALIZATION.pptx
NORMALIZATION.pptx
 
Normalization
NormalizationNormalization
Normalization
 
Normalization review
Normalization reviewNormalization review
Normalization review
 
Normalization_review.ppt
Normalization_review.pptNormalization_review.ppt
Normalization_review.ppt
 
Normalization
Normalization Normalization
Normalization
 
Normalization in Database
Normalization in DatabaseNormalization in Database
Normalization in Database
 
Research gadot
Research gadotResearch gadot
Research gadot
 
eaxmple of Normalisation
eaxmple of Normalisationeaxmple of Normalisation
eaxmple of Normalisation
 
Presentation on Normalization.pptx
Presentation on Normalization.pptxPresentation on Normalization.pptx
Presentation on Normalization.pptx
 
kupdf.net_sql-ebook-w3schoolscom.pdf
kupdf.net_sql-ebook-w3schoolscom.pdfkupdf.net_sql-ebook-w3schoolscom.pdf
kupdf.net_sql-ebook-w3schoolscom.pdf
 
D I T211 Chapter 6
D I T211    Chapter 6D I T211    Chapter 6
D I T211 Chapter 6
 
Normalization
NormalizationNormalization
Normalization
 

Recently uploaded

Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...amitlee9823
 
Detecting Credit Card Fraud: A Machine Learning Approach
Detecting Credit Card Fraud: A Machine Learning ApproachDetecting Credit Card Fraud: A Machine Learning Approach
Detecting Credit Card Fraud: A Machine Learning ApproachBoston Institute of Analytics
 
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...amitlee9823
 
Just Call Vip call girls Mysore Escorts ☎️9352988975 Two shot with one girl (...
Just Call Vip call girls Mysore Escorts ☎️9352988975 Two shot with one girl (...Just Call Vip call girls Mysore Escorts ☎️9352988975 Two shot with one girl (...
Just Call Vip call girls Mysore Escorts ☎️9352988975 Two shot with one girl (...gajnagarg
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Researchmichael115558
 
➥🔝 7737669865 🔝▻ Dindigul Call-girls in Women Seeking Men 🔝Dindigul🔝 Escor...
➥🔝 7737669865 🔝▻ Dindigul Call-girls in Women Seeking Men  🔝Dindigul🔝   Escor...➥🔝 7737669865 🔝▻ Dindigul Call-girls in Women Seeking Men  🔝Dindigul🔝   Escor...
➥🔝 7737669865 🔝▻ Dindigul Call-girls in Women Seeking Men 🔝Dindigul🔝 Escor...amitlee9823
 
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night StandCall Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
Just Call Vip call girls roorkee Escorts ☎️9352988975 Two shot with one girl ...
Just Call Vip call girls roorkee Escorts ☎️9352988975 Two shot with one girl ...Just Call Vip call girls roorkee Escorts ☎️9352988975 Two shot with one girl ...
Just Call Vip call girls roorkee Escorts ☎️9352988975 Two shot with one girl ...gajnagarg
 
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteedamy56318795
 
➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men 🔝mahisagar🔝 Esc...
➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men  🔝mahisagar🔝   Esc...➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men  🔝mahisagar🔝   Esc...
➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men 🔝mahisagar🔝 Esc...amitlee9823
 
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...amitlee9823
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...amitlee9823
 
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...amitlee9823
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...amitlee9823
 
➥🔝 7737669865 🔝▻ Ongole Call-girls in Women Seeking Men 🔝Ongole🔝 Escorts S...
➥🔝 7737669865 🔝▻ Ongole Call-girls in Women Seeking Men  🔝Ongole🔝   Escorts S...➥🔝 7737669865 🔝▻ Ongole Call-girls in Women Seeking Men  🔝Ongole🔝   Escorts S...
➥🔝 7737669865 🔝▻ Ongole Call-girls in Women Seeking Men 🔝Ongole🔝 Escorts S...amitlee9823
 
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24  Building Real-Time Pipelines With FLaNKDATA SUMMIT 24  Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNKTimothy Spann
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...only4webmaster01
 

Recently uploaded (20)

Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
Detecting Credit Card Fraud: A Machine Learning Approach
Detecting Credit Card Fraud: A Machine Learning ApproachDetecting Credit Card Fraud: A Machine Learning Approach
Detecting Credit Card Fraud: A Machine Learning Approach
 
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
 
Just Call Vip call girls Mysore Escorts ☎️9352988975 Two shot with one girl (...
Just Call Vip call girls Mysore Escorts ☎️9352988975 Two shot with one girl (...Just Call Vip call girls Mysore Escorts ☎️9352988975 Two shot with one girl (...
Just Call Vip call girls Mysore Escorts ☎️9352988975 Two shot with one girl (...
 
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Anomaly detection and data imputation within time series
Anomaly detection and data imputation within time seriesAnomaly detection and data imputation within time series
Anomaly detection and data imputation within time series
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
➥🔝 7737669865 🔝▻ Dindigul Call-girls in Women Seeking Men 🔝Dindigul🔝 Escor...
➥🔝 7737669865 🔝▻ Dindigul Call-girls in Women Seeking Men  🔝Dindigul🔝   Escor...➥🔝 7737669865 🔝▻ Dindigul Call-girls in Women Seeking Men  🔝Dindigul🔝   Escor...
➥🔝 7737669865 🔝▻ Dindigul Call-girls in Women Seeking Men 🔝Dindigul🔝 Escor...
 
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night StandCall Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
 
Just Call Vip call girls roorkee Escorts ☎️9352988975 Two shot with one girl ...
Just Call Vip call girls roorkee Escorts ☎️9352988975 Two shot with one girl ...Just Call Vip call girls roorkee Escorts ☎️9352988975 Two shot with one girl ...
Just Call Vip call girls roorkee Escorts ☎️9352988975 Two shot with one girl ...
 
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
 
➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men 🔝mahisagar🔝 Esc...
➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men  🔝mahisagar🔝   Esc...➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men  🔝mahisagar🔝   Esc...
➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men 🔝mahisagar🔝 Esc...
 
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
 
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 
➥🔝 7737669865 🔝▻ Ongole Call-girls in Women Seeking Men 🔝Ongole🔝 Escorts S...
➥🔝 7737669865 🔝▻ Ongole Call-girls in Women Seeking Men  🔝Ongole🔝   Escorts S...➥🔝 7737669865 🔝▻ Ongole Call-girls in Women Seeking Men  🔝Ongole🔝   Escorts S...
➥🔝 7737669865 🔝▻ Ongole Call-girls in Women Seeking Men 🔝Ongole🔝 Escorts S...
 
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24  Building Real-Time Pipelines With FLaNKDATA SUMMIT 24  Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
 

Normalization

  • 1. Normalization February 2017 Business Economics & Information Technology Roxana Tadayon
  • 2. OUTLINE ◼Normalization ◼Anomalies ◼Functional Dependency ◼First Normal Form ◼Second Normal Form ◼Third Normal Form 2
  • 3. Normalization  Normalization is the process of organizing data to minimize data redundancy (data duplication)  If same piece of information is stored more than once, it is called redundant information  The goal of normalization is to decompose relations with anomalies in order to produce smaller and well- structured tables  Normalization theory is based on functional dependencies  The most commonly used normal forms: First normal form(1NF), Second normal form(2NF), Third normal form(3NF) . 3 ID Name Gende r Age DOB Street City Zip_Code Department_ID Department_Name Department Location 1000 Rasmus Jensen M 27 28-05-1990 strandvej 112 Hellerup 2910 098 BE-IT Lygten 16 Copenhagen 2400 1001 Sara Victoria F 19 07-10-1996 Løvstikkevej 500, st. København S 2300 101 Multimedia design Lygten 16 DK 2400 Copenhagen 1003 Jens Rasmusen M 20 09-10-97 Langkærvej 22 København S 2300 098 BE-IT Lygten 16 DK 2400 Copenhagen
  • 4. Anomalies • Database anomalies refer to errors and inconsistencies in the database • Anomalies have a negative effect on the process of inserting, deleting and modifying data in the tables  It is important to remove these anomalies in order to perform different processing on the tables without any problem ◼ http://slideplayer.com/slide/9705202/ 4 ID Name Gender Age DOB Street City Zip_Code Departme nt_ID Department_Nma e Department Location 1000 Rasmus Jensen M 27 28-05-1990 strandvej 112 Hellerup 2910 098 BE-IT Lygten 16 DK 2400 Copenhagen 1001 Sara Victoria F 19 07-10-1996 Løvstikkevej 500, st. Københ avn S 2300 101 Multimedia design Lygten 16 DK 2400 Copenhagen 1003 Jens Rasmusen M 20 09-10-97 Langkærvej 22 Københ avn S 2300 098 BE-IT Lygten 16 DK 2400 Copenhagen
  • 5. Functional Dependency 5  An FD is a relationship between an attribute "Y" and a determinant (1 or more other attributes) "X" such that for a given value of a determinant the value of the attribute is uniquely defined. (written X → Y) if, and only if, each X value is associated with exactly one Y value X → Y X is a determinant X determines Y Y is functionally dependent on X Student_ ID Student_Name 1000 Rasmus Jensen 1001 Sara Victoria 1003 Jens Rasmusen 1004 Sara Victoria 1001 Rasmus Jesnsen Student_ID Student_Name Example: Student_ID determines Student_Name (or Student_Name depends on Student_ID) Each student has exactly one name, but the name could be the name of many students. So Name does not determine Student_ID 1005 Is student_name functionally dependent on Student_ID?
  • 6. First Normal Form ◼A table is said to be in First Normal Form (1NF) if 1. the data in each column be atomic. No multiple values, separated by comma 2. the table does not contain any repeating column groups 3. Identify each record uniquely using primary key 6 Department _Name Student_Name BE_IT Rasums, Jens , Kim Multimedia design Sara It is not possible to INSERT, UPDATE, and DELETE just one student Department _Name Student_Name BEIT Rasmus BEIT Jens BEIT Kim Multimedia design Sara Department _Name Student_Name1 Student_Name2 Student_Name3 BE_IT Rasmus Jens Kim Multimedia design Sara Student_ID 1000 1000 1001 1001
  • 7. Exercise A (1NF) 7 Convert the following table into the first NormalForm Product_Id Product_Name Category Price_1 Price_2 Price_3 200 Table Classic, Glas 708,67 800 932,50 205 Chair Modern, Wood 553,56 475,99
  • 8. Exercise B(1NF) 8 Studentname ZIP_Code Town Course1 Course2 Course3 Course4 Course5 Course6 Course7 Mark Owen 02474 ARLINGTON English German Mathematic s Chemistry Gymnastics Ann Owen 02201 BOSTON English Mathematic s Physics Gymnastics Bill Gates 02474 ARLINGTON English German Mathematic s Chemistry Gymnastics Computing Mark Owen 02201 BOSTON English German Design Mathematic s Chemistry Gymnastics Zen Convert this table into the first NormalForm
  • 9. Second normal form(2NF) 9 Is a table with a single primary key in 2NF? A table is in 2NF if it is in 1NF and every non-primary key (non-prime) attribute is fully functionally dependent on the primary key (and not on a set of primary keys/Composite Key ) If a table is not in 2NF, we will divide it into separate tables (DECOMPOSE) each in 2NF by ensuring that the primary key of each new relation functionally determines all the attributes Find out the non key fields which do not depend on the whole primary key (partial functional dependency column) and then place them in a separate table with a copy of the primary key Is not in second normal form In second normal form In second normal form
  • 10. Decomposition-2NF 10 Lecture r_ID Lecturer_Name Gen der DOB Department_I D Department_N ame Street City Zip_Code Head of Department 100 Jesper Frederiksen M NULL 022 BEIT Lygten 16 København 2400 Ola Pukkii 101 Lars Thomasen M 09-10-1955 053 Datamatiker Lygten 37 København 2400 Annette Havkær 102 Kim juhl M NULL 022 BEIT Lygten 16 København 2400 Ola Pukkii 103 Jens Rasmusen M 29-12-80 053 Datamatiker Lygten 37 København 2400 Annette Havkær 104 Tina Jensen F 15-03-1965 008 Design Guldbergsgade 29N København 2200 Mette Harrestrup
  • 11. Decomposition-2NF 11 Lecturer_ID Lecturer_Name Gender DOB 100 Jesper Frederiksen M NULL 101 Lars Thomasen M 09-10-1955 102 Kim juhl M NULL 103 Jens Rasmusen M 29-12-80 104 Tina Jensen F 15-03-1965 Department_ID Department_Name Street City Zip_Code Head of Department 022 BEIT Lygten 16 København 2400 Ola Pukkii 053 Datamatiker Lygten 37 København 2400 Annette Havkær 008 Design Guldbergsgade 29 København 2200 Mette Harrestrup Department_ID 022 053 022 053 008 How to Find the Relationship Between Two Tables? MANY TO MANY??
  • 12. Exercise C (2NF) 12 Convert the following table into the second NormalForm S# STATUS CITY P# QTY S1 20 London P1 300 S1 20 London P2 200 S1 20 London P3 400 S1 20 London P4 200 S1 20 London P5 100 S1 20 London P6 100 S2 10 Paris P1 300 S2 10 Paris P2 200 S3 10 Paris P2 200 S4 20 London P2 200 S4 20 London P4 200 S4 20 London P5 100
  • 13. Exercise D (2NF) 13 Provider ID DiagnonisCode DiagnonisDescrip tion ServiceLocationI D ServiceCity ServiceState ServiceDate 8472 798 Fever 354 St.Louis MO 20-03-2015 8427 678 Hypertension 278 KirkWood MA 10-03-2015 1928 798 Fever 452 Austin TX 10-09-08 1928 536 Stomach Gas 867 Kyle TX 78-01-02 ◼Convert the following table into the second NormalForm
  • 14. Third normal form(3NF) 14 A table is in 2NF if I. It is in 1NF II. All nonprimary fields are dependent on the primary key OR Nonprimary key attributes don’t depend on other nonprimary key attributes OR No transitive functional dependencies between two non-keys attributes A B (B A) B C A C
  • 15. Example-Third normal form(3NF) 15 Department_ID Department_Name Street City Zip_Code 022 BEIT Lygten 16 København NV 2400 014 Construction Management Guldbergsgade 29 København N 2200 020 Multimedia Lygten 16 København NV 2400 053 Tech Landskronagade 64 København Ø 2100 002 Datamatiker Lygten 37 København NV 2400 008 Design Guldbergsgade 29 København N 2200 A B (B A) Department_ID City City Department_ID B C City Zip_Code A C Department_ID Zip_Code
  • 16. Decomposition-3NF 16  Decompose tables(s) to eliminate transitive functional dependencies  Move all columns involved in transitive dependencies to a new table  Identify a primary key for the new entity.  Place the primary key for the new table as a foreign key on the original table Department_ID Department_Name Street 022 BEIT Lygten 16 014 Construction Management Guldbergsgade 29 020 Multimedia Lygten 16 053 Tech Landskronagade 64 002 Datamatiker Lygten 37 008 Design Guldbergsgade 29 City Zip_Code København NV 2400 København N 2200 København Ø 2100 Zip_Code 2400 2200 2400 2100 2400 2200 All transitive dependencies are removed to place in another table
  • 17. Exercise E (3NF) 17 ◼Convert the following table into the third NormalForm Cutomer_ID Customer_FirstName Customer_LastName Customer_DOB AccNO BankCode Bank 1002 Helle Allamn 09-10-1978 100987654 9090 BOA 1003 Chad Herlof 12-12-1950 100987655 9090 BOA 1004 Ken Rasmusen 01-08-1999 100987656 8920 CAPITA1 1005 Tina Borup 29-06-1970 100987657 8920 CAPITAL1
  • 18. Exercise F (3NF) ◼Continue normalization (2NF & 3NF) of the tables of Exercises A & B 18
  • 19. HAND-IN 19 NAME CPR ADDRESS ZIP_CODE PHONE BIRTH_OF_DATE MARITALSTATUS GENDER RACE SMOKER DRUG_ABUSE DRIVINGLICENSNUM DRIVINGLICENSESTATE NEAREST RELATIVE PHONE NUMBER OF NEAREST RELATIVE INSURANCE NUMBER INSURANCE NAME DATE OF INSURANCE COVERAGE REASON OF HOSPITALIZATION DATE OF HOSPITALIZATION Create a patient table with the following information. Normalize the table and then insert information of 5 patients into the tables. Specify keys, the relationships, and the cardinalities between the tables
  • 20. Summary 20 FIRST NORMAL FORM (1NF) No repeating values and No repeating groups Specify primary key SECOND NORMAL FORM (2NF) No non-key values based on just part of a composite key Third NORMAL FORM (3NF) No non-key values based on other non-key values https://www.youtube.com/watch?v=UrYLYV7WSHM