Sunteți pe pagina 1din 15

| Introduction

Database Design

Poorly designed databases

Someone pays for extras


Speed Storage Man power

Copyright Mutlu Mete, Ph.D.

| Anomalies

Anomalies

Redundant Storage

Repeatedly stored information


Name John Tom Address 123 Main 111 S. Oak Clinic 6 2 Cli. Line 116 102

Pat. ID 1 2

3
4 5 6

Alice
John Jerry Ray

999 N. Fir
567 W. 12 501 Flint 321 Tree

4
1 5 5

114
101 165 165

Copyright Mutlu Mete, Ph.D.

| Anomalies

Anomalies

Deletion Anomaly

Deleting some information causes losing of others.


Name John Tom Address 123 Main 111 S. Oak Clinic 6 2 Cli. Line 116 102

Pat. ID 1 2

3
4 5 6

Alice
John Jerry Ray

999 N. Fir
567 W. 12 501 Flint 321 Tree

4
1 5 5

114
101 165 165

Copyright Mutlu Mete, Ph.D.

| Anomalies

Anomalies

Update Anomaly
Updating one copy of repeated information results in inconsistency between them
Pat. ID 1 2 Name John Tom Address 123 Main 111 S. Oak Clinic 6 2 Cli. Line 116 102

3
4 5 6

Alice
John Jerry Ray

999 N. Fir
567 W. 12 501 Flint 321 Tree

4
1 5 5

114
101 165 165 185

Copyright Mutlu Mete, Ph.D.

| Anomalies

Anomalies

Insertion Anomaly

Absence of some information blocks entering others


Name John Tom Address 123 Main 111 S. Oak Clinic 6 2 Cli. Line 116 102

Pat. ID 1 2

3
4 5 6

Alice
John Jerry Ray

999 N. Fir
567 W. 12 501 Flint 321 Tree

4
1 5 5

114
101 165 165

Matt

901 Main

Copyright Mutlu Mete, Ph.D.

| Normalization

Normalization

Process of creating an efficient, reliable, flexible structure


To minimize data duplication To ensure data is logically store

Copyright Mutlu Mete, Ph.D.

| Normalization

Normalization
Avoid anomalies Optimizing table structures Improve speed Remove same data More efficient in usage of storage media Lessen redundancy Improved data integrity

Copyright Mutlu Mete, Ph.D.

| Normalization

Normalization

0NF

1NF

2NF

3NF

Copyright Mutlu Mete, Ph.D.

| Normalization

Normalization 0NF

None of normalization rules have been applied


Phy. Name John Tom Alice Patient Name Smith Jerry Jack Lisa Nancy

Phy. ID 1 2 3

Weights 60, 70, 80 55, 58 90, 77 99 84

Copyright Mutlu Mete, Ph.D.

| Normalization

Normalization 1NF
All occurrences of an entity must contain the same number of atomic attributes.

Phy. ID 1 2 3 Phy. Name John Tom Alice Patient Name Smith Jerry Jack Lisa Nancy Weights 60, 70, 80 55, 58 90, 77 99 84

Copyright Mutlu Mete, Ph.D.

| Normalization

Normalization 1NF
Visit ID 1 2 3 4 Phy. ID 1 Phy. Name John 5 Phy. ID 1 1 2 2 3 Phy. Visit ID Name 1 Smith Jerry Jack Lisa Nancy 1 1 Wght. ID 1 2 3 Weight 60 70 80

2
2 3 3

4
5 6 7

55
58 90 77

2
3

Tom
Alice

4
5

8
9

99
84

Copyright Mutlu Mete, Ph.D.

| Normalization

Normalization 2NF
Every non-key column must be fully dependent on the entire primary key

Pat. ID 1 1 1 2 Phy. ID 1 2 3 1 Diag. Cold Flu Allergy Flu Phy. Address 123 Main 526 S. Oak 355 N. Pole 123 Main

2
3 4 5 6

3
1 3 2 2

Insomnia
Sinuses Cold Allergy Stomach Ulcer

355 N. Pole
123 Main 355 N. Pole 526 S. Oak 526 S. Oak
Copyright Mutlu Mete, Ph.D.

| Normalization

Normalization 2NF
Pat. ID 1 1 Phy. ID 1 2 Diag. Cold Flu

1
2 2 3 4 Phy. ID 5 Phy. Address 6

3
1 3 1 3 2 2

Allergy
Flu Insomnia Sinuses Cold Allergy Stomach Ulcer

1
2 3

123 Main
526 S. Oak 355 N. Pole
Copyright Mutlu Mete, Ph.D.

| Normalization

Normalization 3NF
Remove attributes that are not dependent on the primary key

Visit. ID 1 2 3 4 Phy. ID 1 2 3 1 Pat. Name Nancy John Lisa Andrew Visit. Room 501 402 303 501

5
6 7

3
1 3

Lisa
Kerry Matt

303
501 303

Copyright Mutlu Mete, Ph.D.

| Normalization

Normalization 3NF
Visit. ID 1 Phy. ID 1 Pat. Name Nancy

2
3 4 5 6

2
3 1 3 1

John
Lisa Andrew Lisa Kerry

7 Phy. ID
1 2 3

Matt

Visit. Room
501 402 303
Copyright Mutlu Mete, Ph.D.

S-ar putea să vă placă și