SlideShare a Scribd company logo
1 of 17
Normalization
Practice & Solutions
Chapter 12
Part-2: Normalization
1
Practice Problem #1
2
3
Normalization Practice #1
 It’s already in 1NF …but you need to understand why!
 Convert this to 2NF. How many tables do you now have?
 Convert this to 3NF. How many tables do you now have?
Order
No
Prod
No
Cust
No
Name Addr City St Zip Order
Date
Promised
Date
Desc Qty
Ord
Unit
Price
61384 A128 1273 Cont. Designs 123 Oak Austin TX 78746 11/04/15 11/21/15 Bookcase 4 200
61384 B381 1273 Cont. Designs 123 Oak Austin TX 78746 11/04/15 11/21/15 Cabinet 2 150
61384 R210 1273 Cont. Designs 123 Oak Austin TX 78746 11/04/15 11/21/15 Table 1 500
62890 W891 3891 J Consultants 523 Pine Waco TX 76712 11/15/15 11/21/15 Chair 2 300
62890 A128 3891 J Consultants 523 Pine Waco TX 76712 11/15/15 11/21/15 Bookcase 8 200
63129 W891 1273 Cont. Designs 123 Oak Austin TX 78746 12/10/15 12/29/15 Chair 6 300
64000 B381 4545 ABC Ins Co 555 Elm OKC OK 73134 04/10/15 05/17/15 Cabinet 1 150
64000 A128 4545 ABC Ins Co 555 Elm OKC OK 73134 04/10/15 05/17/15 Bookcase 1 200
OrderProduct Table
SOLUTION #1
4
5
Normalization Practice #1
 It’s already in 1NF …but you need to understand why!
 No multi-valued attributes!
 Convert this to 2NF. How many tables do you now have?
 Convert this to 3NF. How many tables do you now have?
Order
No
Prod
No
Cust
No
Name Addr City St Zip Order
Date
Promised
Date
Desc Qty
Ord
Unit
Price
61384 A128 1273 Cont. Designs 123 Oak Austin TX 78746 11/04/15 11/21/15 Bookcase 4 200
61384 B381 1273 Cont. Designs 123 Oak Austin TX 78746 11/04/15 11/21/15 Cabinet 2 150
61384 R210 1273 Cont. Designs 123 Oak Austin TX 78746 11/04/15 11/21/15 Table 1 500
62890 W891 3891 J Consultants 523 Pine Waco TX 76712 11/15/15 11/21/15 Chair 2 300
62890 A128 3891 J Consultants 523 Pine Waco TX 76712 11/15/15 11/21/15 Bookcase 8 200
63129 W891 1273 Cont. Designs 123 Oak Austin TX 78746 12/10/15 12/29/15 Chair 6 300
64000 B381 4545 ABC Ins Co 555 Elm OKC OK 73134 04/10/15 05/17/15 Cabinet 1 150
64000 A128 4545 ABC Ins Co 555 Elm OKC OK 73134 04/10/15 05/17/15 Bookcase 1 200
OrderProduct Table
Resolving to 2NF
OrderProduct (OrderNo, ProdNo, CustNo, Name, Addr, City, St, Zip, OrderDate, PromisedDate, Desc, QtyOrd, UnitPrice)
OrderNo, ProdNo  QtyOrd
OrderNo  CustNo, Name, Addr, City, St, Zip, OrderDate, PromisedDate
ProdNo  Desc, UnitPrice
          
2NF SOLUTION:
Convert the original table (which already was in 1st Normal Form) to 2nd Normal Form
Order
No
Prod
No
Qty
Ord
61384 A128 4
61384 B381 2
61384 R210 1
62890 W891 2
62890 A128 8
63129 W891 6
64000 B381 1
64000 A128 1
Order
No
Cust
No
Name Addr City St Zip Order
Date
Promised
Date
61384 1273 Cont. Designs 123 Oak Austin TX 78746 11/04/15 11/21/15
62890 3891 J Consultants 523 Pine Waco TX 76712 11/15/15 11/21/15
63129 1273 Cont. Designs 123 Oak Austin TX 78746 12/10/15 12/29/15
64000 4545 ABC Ins Co 555 Elm OKC OK 73134 04/10/15 05/17/15
Prod
No
Desc Unit
Price
A128 Bookcase 200
B381 Cabinet 150
R210 Table 500
W891 Chair 300
Example A: 2NF
OrderProduct Table Order Table Product Table
OrderNo, ProdNo  QtyOrd
OrderNo  CustNo, Name, Addr, City, St, Zip, OrderDate, PromisedDate
ProdNo  Desc, UnitPrice
2NF SOLUTION:
Resolving to 3NF
OrderProduct (OrderNo, ProdNo, QtyOrd)
Order (OrderNo, CustNo, Name, Addr, City, St, Zip, OrderDate, PromisedDate)
Product (ProdNo, Desc, UnitPrice)

  

3NF SOLUTION:
OrderNo, ProdNo  QtyOrd
OrderNo  CustNo, OrderDate, PromisedDate
ProdNo  Desc, UnitPrice
CustNo  Name, Addr, City, St, Zip
Zip  St
Already in 3NF
Already in 3NF
Convert the 2nd Normal Form tables into 3rd Normal Form
 
 

Example A: 3NF
Cust
No
Name Addr City Zip
1273 Cont. Designs 123 Oak Austin 78746
3891 J Consultants 523 Pine Waco 76712
4545 ABC Ins Co 555 Elm OKC 73134
Zip St
73134 OK
76712 TX
78746 TX
Order
No
Prod
No
Qty
Ord
61384 A128 4
61384 B381 2
61384 R210 1
62890 W891 2
62890 A128 8
63129 W891 6
64000 B381 1
64000 A128 1
Order
No
Cust
No
Order
Date
Promised
Date
61384 1273 11/04/15 11/21/15
62890 3891 11/15/15 11/21/15
63129 1273 12/10/15 12/29/15
64000 4545 04/10/15 05/17/15
Prod
No
Desc Unit
Price
A128 Bookcase 200
B381 Cabinet 150
R210 Table 500
W891 Chair 300
OrderProduct Table Order Table Product Table
Customer Table Zip Table
10
Order
Customer
OrderProduct
0..*
1..1
1..*
0..*
Product
Zip
1..*
1..1
0..*
Practice Problem #2
11
12
Normalization Practice #2
Appointment Table
Appt
No
Appt
Date
Appt
Time
Planned
Duration
Appt
Type
Patient
ID
First
Nm
Last
Nm Phone
Doctor
ID
Doctor
Nm
1 12/1/2015 3:00 AM 1.00 Physical 466927 Lisa Garcia 562-3456 C678 Chapman
2 12/1/2015 3:00 AM 0.25 Shot 456789 Sue Carey 432-1234 A528 Lopez
3 12/1/2015 3:15 AM 0.50 Flu 194756 Brandon Pierre 432-7877 S626 Smith
4 12/2/2015 10:00 AM 0.50 Migraine 329657 Marcus Schwartz 239-5502 A528 Lopez
5 12/2/2015 10:15 AM 0.25 Shot 987453 Mike Jones 456-0202 G123 Gray
6 12/2/2015 10:30 AM 0.25 Shot 384788 Tonya Johnson 432-8806 S626 Smith
7 12/2/2015 10:45 AM 0.50 Flu 438754 Iliana Hnatt 823-4303 C678 Chapman
8 12/2/2015 11:00 AM 1.00 Physical 345875 Carla Basich 857-5566 A528 Lopez
9 12/3/2015 10:30 AM 1.00 Physical 466927 Lisa Garcia 562-3456 C678 Chapman
10 12/3/2015 9:00 AM 0.50 Migraine 345875 Carla Basich 857-5666 C678 Chapman
 It’s already in 1NF, and 2NF …but you need to understand why!
 Convert this to 3NF. How many tables do you now have?
SOLUTION #2
13
14
Normalization Practice #2
Appointment Table
Appt
No
Appt
Date
Appt
Time
Planned
Duration
Appt
Type
Patient
ID
First
Nm
Last
Nm Phone
Doctor
ID
Doctor
Nm
1 12/1/2015 3:00 AM 1.00 Physical 466927 Lisa Garcia 562-3456 C678 Chapman
2 12/1/2015 3:00 AM 0.25 Shot 456789 Sue Carey 432-1234 A528 Lopez
3 12/1/2015 3:15 AM 0.50 Flu 194756 Brandon Pierre 432-7877 S626 Smith
4 12/2/2015 10:00 AM 0.50 Migraine 329657 Marcus Schwartz 239-5502 A528 Lopez
5 12/2/2015 10:15 AM 0.25 Shot 987453 Mike Jones 456-0202 G123 Gray
6 12/2/2015 10:30 AM 0.25 Shot 384788 Tonya Johnson 432-8806 S626 Smith
7 12/2/2015 10:45 AM 0.50 Flu 438754 Iliana Hnatt 823-4303 C678 Chapman
8 12/2/2015 11:00 AM 1.00 Physical 345875 Carla Basich 857-5566 A528 Lopez
9 12/3/2015 10:30 AM 1.00 Physical 466927 Lisa Garcia 562-3456 C678 Chapman
10 12/3/2015 9:00 AM 0.50 Migraine 345875 Carla Basich 857-5666 C678 Chapman
 It’s already in 1NF, and 2NF …but you need to understand why!
 1NF: No Multivalued attributes
 2NF: No partial dependencies – entire PK determines each non-key attribute
 Convert this to 3NF. How many tables do you now have?
Resolving to 3NF
3NF SOLUTION:
ApptNo  ApptDt, ApptTm, PlannedDur, ApptType, PatientID, DoctorID
PatientID  FirstNm, LastNm, Phone
DoctorID  DoctorNm
Appointment(ApptNo, ApptDt, ApptTm, PlannedDur, ApptType, PatientID, FirstNm, LastNm, Phone, DoctorID, DoctorNm)
  


This is the original table
   

ApptType  PlannedDur
Normalization Practice #2
16
Appointment Table
Appt
No
Appt
Date
Appt
Time
Appt
Type
Patient
ID
Doctor
ID
1 12/1/2015 3:00 AMPhysical 466927 C678
2 12/1/2015 3:00 AMShot 456789 A528
3 12/1/2015 3:15 AMFlu 194756 S626
4 12/2/2015 10:00 AMMigraine 329657 A528
5 12/2/2015 10:15 AMShot 987453 G123
6 12/2/2015 10:30 AMShot 384788 S626
7 12/2/2015 10:45 AMFlu 438754 C678
8 12/2/2015 11:00 AMPhysical 345875 A528
9 12/3/2015 10:30 AMPhysical 466927 C678
10 12/3/2015 9:00 AMMigraine 345875 C678
Patient
ID
First
Nm
Last
Nm Phone
194756 Brandon Pierre 432-7877
329657 Marcus Schwartz 239-5502
345875 Carla Basich 857-5566
384788 Tonya Johnson 432-8806
438754 Iliana Hnatt 823-4303
456789 Sue Carey 432-1234
466927 Lisa Garcia 562-3456
987453 Mike Jones 456-0202
Doctor
ID
Doctor
Nm
A528 Lopez
C678 Chapman
G123 Gray
S626 Smith
Patient Table Doctor Table
Appt
Type
Planned
Duration
Flu 0.50
Migraine 0.50
Physical 1.00
Shot 0.25
Appt Type Table
17
Patient
Appointment
0..*
1..1
Doctor
Appt Type
1..1
0..*
0..*
1..1

More Related Content

What's hot

Database Normalization
Database NormalizationDatabase Normalization
Database NormalizationSmriti Jain
 
Sql queries presentation
Sql queries presentationSql queries presentation
Sql queries presentationNITISH KUMAR
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL CommandsShrija Madhu
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity ConstraintsMegha yadav
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMSkoolkampus
 
Cost estimation for Query Optimization
Cost estimation for Query OptimizationCost estimation for Query Optimization
Cost estimation for Query OptimizationRavinder Kamboj
 
Database Relationships
Database RelationshipsDatabase Relationships
Database Relationshipswmassie
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting AlgorithmsPranay Neema
 
Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive Raj Naik
 
Algorithms Lecture 4: Sorting Algorithms I
Algorithms Lecture 4: Sorting Algorithms IAlgorithms Lecture 4: Sorting Algorithms I
Algorithms Lecture 4: Sorting Algorithms IMohamed Loey
 
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
 
Key and its different types
Key and its different typesKey and its different types
Key and its different typesUmair Shakir
 

What's hot (20)

Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Single linked list
Single linked listSingle linked list
Single linked list
 
Database Normalization
Database NormalizationDatabase Normalization
Database Normalization
 
Sql queries presentation
Sql queries presentationSql queries presentation
Sql queries presentation
 
SQL Functions
SQL FunctionsSQL Functions
SQL Functions
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
 
Cost estimation for Query Optimization
Cost estimation for Query OptimizationCost estimation for Query Optimization
Cost estimation for Query Optimization
 
Database Relationships
Database RelationshipsDatabase Relationships
Database Relationships
 
Normalization
NormalizationNormalization
Normalization
 
Dbms practical list
Dbms practical listDbms practical list
Dbms practical list
 
joins in database
 joins in database joins in database
joins in database
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
 
Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive
 
The Relational Model
The Relational ModelThe Relational Model
The Relational Model
 
Algorithms Lecture 4: Sorting Algorithms I
Algorithms Lecture 4: Sorting Algorithms IAlgorithms Lecture 4: Sorting Algorithms I
Algorithms Lecture 4: Sorting Algorithms I
 
SQL Basics
SQL BasicsSQL Basics
SQL Basics
 
Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)
 
Key and its different types
Key and its different typesKey and its different types
Key and its different types
 

Recently uploaded

Capstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramCapstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramMoniSankarHazra
 
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
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxolyaivanovalion
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxolyaivanovalion
 
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779Delhi Call girls
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Zuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxZuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxolyaivanovalion
 
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...Pooja Nehwal
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxolyaivanovalion
 
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
 
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightCheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightDelhi Call girls
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxolyaivanovalion
 
Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...shambhavirathore45
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxfirstjob4
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptxAnupama Kate
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAroojKhan71
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxMohammedJunaid861692
 

Recently uploaded (20)

Capstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramCapstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics Program
 
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...
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptx
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
 
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Zuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxZuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptx
 
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptx
 
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 ...
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightCheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptx
 
Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptx
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
 

Normalization Practice case study.pptx

  • 1. Normalization Practice & Solutions Chapter 12 Part-2: Normalization 1
  • 3. 3 Normalization Practice #1  It’s already in 1NF …but you need to understand why!  Convert this to 2NF. How many tables do you now have?  Convert this to 3NF. How many tables do you now have? Order No Prod No Cust No Name Addr City St Zip Order Date Promised Date Desc Qty Ord Unit Price 61384 A128 1273 Cont. Designs 123 Oak Austin TX 78746 11/04/15 11/21/15 Bookcase 4 200 61384 B381 1273 Cont. Designs 123 Oak Austin TX 78746 11/04/15 11/21/15 Cabinet 2 150 61384 R210 1273 Cont. Designs 123 Oak Austin TX 78746 11/04/15 11/21/15 Table 1 500 62890 W891 3891 J Consultants 523 Pine Waco TX 76712 11/15/15 11/21/15 Chair 2 300 62890 A128 3891 J Consultants 523 Pine Waco TX 76712 11/15/15 11/21/15 Bookcase 8 200 63129 W891 1273 Cont. Designs 123 Oak Austin TX 78746 12/10/15 12/29/15 Chair 6 300 64000 B381 4545 ABC Ins Co 555 Elm OKC OK 73134 04/10/15 05/17/15 Cabinet 1 150 64000 A128 4545 ABC Ins Co 555 Elm OKC OK 73134 04/10/15 05/17/15 Bookcase 1 200 OrderProduct Table
  • 5. 5 Normalization Practice #1  It’s already in 1NF …but you need to understand why!  No multi-valued attributes!  Convert this to 2NF. How many tables do you now have?  Convert this to 3NF. How many tables do you now have? Order No Prod No Cust No Name Addr City St Zip Order Date Promised Date Desc Qty Ord Unit Price 61384 A128 1273 Cont. Designs 123 Oak Austin TX 78746 11/04/15 11/21/15 Bookcase 4 200 61384 B381 1273 Cont. Designs 123 Oak Austin TX 78746 11/04/15 11/21/15 Cabinet 2 150 61384 R210 1273 Cont. Designs 123 Oak Austin TX 78746 11/04/15 11/21/15 Table 1 500 62890 W891 3891 J Consultants 523 Pine Waco TX 76712 11/15/15 11/21/15 Chair 2 300 62890 A128 3891 J Consultants 523 Pine Waco TX 76712 11/15/15 11/21/15 Bookcase 8 200 63129 W891 1273 Cont. Designs 123 Oak Austin TX 78746 12/10/15 12/29/15 Chair 6 300 64000 B381 4545 ABC Ins Co 555 Elm OKC OK 73134 04/10/15 05/17/15 Cabinet 1 150 64000 A128 4545 ABC Ins Co 555 Elm OKC OK 73134 04/10/15 05/17/15 Bookcase 1 200 OrderProduct Table
  • 6. Resolving to 2NF OrderProduct (OrderNo, ProdNo, CustNo, Name, Addr, City, St, Zip, OrderDate, PromisedDate, Desc, QtyOrd, UnitPrice) OrderNo, ProdNo  QtyOrd OrderNo  CustNo, Name, Addr, City, St, Zip, OrderDate, PromisedDate ProdNo  Desc, UnitPrice            2NF SOLUTION: Convert the original table (which already was in 1st Normal Form) to 2nd Normal Form
  • 7. Order No Prod No Qty Ord 61384 A128 4 61384 B381 2 61384 R210 1 62890 W891 2 62890 A128 8 63129 W891 6 64000 B381 1 64000 A128 1 Order No Cust No Name Addr City St Zip Order Date Promised Date 61384 1273 Cont. Designs 123 Oak Austin TX 78746 11/04/15 11/21/15 62890 3891 J Consultants 523 Pine Waco TX 76712 11/15/15 11/21/15 63129 1273 Cont. Designs 123 Oak Austin TX 78746 12/10/15 12/29/15 64000 4545 ABC Ins Co 555 Elm OKC OK 73134 04/10/15 05/17/15 Prod No Desc Unit Price A128 Bookcase 200 B381 Cabinet 150 R210 Table 500 W891 Chair 300 Example A: 2NF OrderProduct Table Order Table Product Table OrderNo, ProdNo  QtyOrd OrderNo  CustNo, Name, Addr, City, St, Zip, OrderDate, PromisedDate ProdNo  Desc, UnitPrice 2NF SOLUTION:
  • 8. Resolving to 3NF OrderProduct (OrderNo, ProdNo, QtyOrd) Order (OrderNo, CustNo, Name, Addr, City, St, Zip, OrderDate, PromisedDate) Product (ProdNo, Desc, UnitPrice)      3NF SOLUTION: OrderNo, ProdNo  QtyOrd OrderNo  CustNo, OrderDate, PromisedDate ProdNo  Desc, UnitPrice CustNo  Name, Addr, City, St, Zip Zip  St Already in 3NF Already in 3NF Convert the 2nd Normal Form tables into 3rd Normal Form     
  • 9. Example A: 3NF Cust No Name Addr City Zip 1273 Cont. Designs 123 Oak Austin 78746 3891 J Consultants 523 Pine Waco 76712 4545 ABC Ins Co 555 Elm OKC 73134 Zip St 73134 OK 76712 TX 78746 TX Order No Prod No Qty Ord 61384 A128 4 61384 B381 2 61384 R210 1 62890 W891 2 62890 A128 8 63129 W891 6 64000 B381 1 64000 A128 1 Order No Cust No Order Date Promised Date 61384 1273 11/04/15 11/21/15 62890 3891 11/15/15 11/21/15 63129 1273 12/10/15 12/29/15 64000 4545 04/10/15 05/17/15 Prod No Desc Unit Price A128 Bookcase 200 B381 Cabinet 150 R210 Table 500 W891 Chair 300 OrderProduct Table Order Table Product Table Customer Table Zip Table
  • 12. 12 Normalization Practice #2 Appointment Table Appt No Appt Date Appt Time Planned Duration Appt Type Patient ID First Nm Last Nm Phone Doctor ID Doctor Nm 1 12/1/2015 3:00 AM 1.00 Physical 466927 Lisa Garcia 562-3456 C678 Chapman 2 12/1/2015 3:00 AM 0.25 Shot 456789 Sue Carey 432-1234 A528 Lopez 3 12/1/2015 3:15 AM 0.50 Flu 194756 Brandon Pierre 432-7877 S626 Smith 4 12/2/2015 10:00 AM 0.50 Migraine 329657 Marcus Schwartz 239-5502 A528 Lopez 5 12/2/2015 10:15 AM 0.25 Shot 987453 Mike Jones 456-0202 G123 Gray 6 12/2/2015 10:30 AM 0.25 Shot 384788 Tonya Johnson 432-8806 S626 Smith 7 12/2/2015 10:45 AM 0.50 Flu 438754 Iliana Hnatt 823-4303 C678 Chapman 8 12/2/2015 11:00 AM 1.00 Physical 345875 Carla Basich 857-5566 A528 Lopez 9 12/3/2015 10:30 AM 1.00 Physical 466927 Lisa Garcia 562-3456 C678 Chapman 10 12/3/2015 9:00 AM 0.50 Migraine 345875 Carla Basich 857-5666 C678 Chapman  It’s already in 1NF, and 2NF …but you need to understand why!  Convert this to 3NF. How many tables do you now have?
  • 14. 14 Normalization Practice #2 Appointment Table Appt No Appt Date Appt Time Planned Duration Appt Type Patient ID First Nm Last Nm Phone Doctor ID Doctor Nm 1 12/1/2015 3:00 AM 1.00 Physical 466927 Lisa Garcia 562-3456 C678 Chapman 2 12/1/2015 3:00 AM 0.25 Shot 456789 Sue Carey 432-1234 A528 Lopez 3 12/1/2015 3:15 AM 0.50 Flu 194756 Brandon Pierre 432-7877 S626 Smith 4 12/2/2015 10:00 AM 0.50 Migraine 329657 Marcus Schwartz 239-5502 A528 Lopez 5 12/2/2015 10:15 AM 0.25 Shot 987453 Mike Jones 456-0202 G123 Gray 6 12/2/2015 10:30 AM 0.25 Shot 384788 Tonya Johnson 432-8806 S626 Smith 7 12/2/2015 10:45 AM 0.50 Flu 438754 Iliana Hnatt 823-4303 C678 Chapman 8 12/2/2015 11:00 AM 1.00 Physical 345875 Carla Basich 857-5566 A528 Lopez 9 12/3/2015 10:30 AM 1.00 Physical 466927 Lisa Garcia 562-3456 C678 Chapman 10 12/3/2015 9:00 AM 0.50 Migraine 345875 Carla Basich 857-5666 C678 Chapman  It’s already in 1NF, and 2NF …but you need to understand why!  1NF: No Multivalued attributes  2NF: No partial dependencies – entire PK determines each non-key attribute  Convert this to 3NF. How many tables do you now have?
  • 15. Resolving to 3NF 3NF SOLUTION: ApptNo  ApptDt, ApptTm, PlannedDur, ApptType, PatientID, DoctorID PatientID  FirstNm, LastNm, Phone DoctorID  DoctorNm Appointment(ApptNo, ApptDt, ApptTm, PlannedDur, ApptType, PatientID, FirstNm, LastNm, Phone, DoctorID, DoctorNm)      This is the original table      ApptType  PlannedDur
  • 16. Normalization Practice #2 16 Appointment Table Appt No Appt Date Appt Time Appt Type Patient ID Doctor ID 1 12/1/2015 3:00 AMPhysical 466927 C678 2 12/1/2015 3:00 AMShot 456789 A528 3 12/1/2015 3:15 AMFlu 194756 S626 4 12/2/2015 10:00 AMMigraine 329657 A528 5 12/2/2015 10:15 AMShot 987453 G123 6 12/2/2015 10:30 AMShot 384788 S626 7 12/2/2015 10:45 AMFlu 438754 C678 8 12/2/2015 11:00 AMPhysical 345875 A528 9 12/3/2015 10:30 AMPhysical 466927 C678 10 12/3/2015 9:00 AMMigraine 345875 C678 Patient ID First Nm Last Nm Phone 194756 Brandon Pierre 432-7877 329657 Marcus Schwartz 239-5502 345875 Carla Basich 857-5566 384788 Tonya Johnson 432-8806 438754 Iliana Hnatt 823-4303 456789 Sue Carey 432-1234 466927 Lisa Garcia 562-3456 987453 Mike Jones 456-0202 Doctor ID Doctor Nm A528 Lopez C678 Chapman G123 Gray S626 Smith Patient Table Doctor Table Appt Type Planned Duration Flu 0.50 Migraine 0.50 Physical 1.00 Shot 0.25 Appt Type Table