Normalization: ITM 692 Sanjay Goel
Normalization: ITM 692 Sanjay Goel
ITM 692
Sanjay Goel
Number of Tables
Redundancy
– Second Normal Form (2NF)
Complexity
– Third Normal Form (3NF)
– Boyce-Codd Normal Form (BCNF)
– Fourth Normal Form (4NF)
– Fifth Normal Form (5NF)
– Domain Key Normal Form (DKNF)
Most
Mostdatabases
databasesshould
shouldbe
be3NF
3NFor
orBCNF
BCNFininorder
ordertotoavoid
avoidthe
thedatabase
databaseanomalies.
anomalies.
Each
Eachhigher
higherlevel
levelisisaasubset
subsetof
ofthe
thelower
lowerlevel
level
05/30/21 Sanjay Goel, School of Business, University at 6 of 34
Albany
Normalization
First Normal Form (1NF)
A table is considered to be in 1NF if all the fields contain
only scalar values (as opposed to list of values).
Author
Authorand
andAuPhone
AuPhonecolumns
columnsare
arenot
notscalar
scalar
Example 1
ISBN Title Price Table Scheme: {ISBN, Title, Price}
0-321-32132-1 Balloon $34.00 Functional Dependencies: {ISBN} {Title}
0-55-123456-9 Main Street $22.95 {ISBN} {Price}
0-123-45678-0 Ulysses $34.00
Example 3
AuID AuName AuPhone Table Scheme: {AuID, AuName, AuPhone}
1 Sleepy 321-321-1111 Functional Dependencies: {AuId} {AuPhone}
2 Snoopy 232-234-1234
{AuId} {AuName}
3 Grumpy 665-235-6532
{AuName, AuPhone} {AuID}
4 Jones 123-333-3333
5 Smith 654-223-3455
6 Joyce 666-666-6666
7 Roman 444-444-4444
Example:
BuildingID Contractor
Contractor Fee
Randolph 1200
Ingersoll 1100
Pitkin 1100
05/30/21 Sanjay Goel, School of Business, University at 21 of 34
Albany
Normalization
Boyce-Codd Normal Form (BCNF)
• BCNF does not allow dependencies between attributes that belong to candidate
keys.
• BCNF is a refinement of the third normal form in which it drops the restriction
of a non-key attribute from the 3rd normal form.
• Third normal form and BCNF are not same if following conditions are true:
– The table has two or more candidate keys
– At least two of the candidate keys are composed of more than one attribute
– The keys are not disjoint i.e. The composite candidate keys share some attributes
Example 1 - Address (Not in BCNF)
Scheme {City, Street, ZipCode}
1. Key1 {City, Street }
2. Key2 {ZipCode, Street}
3. No non-key attribute hence 3NF
4. {City, Street} {ZipCode}
5. {ZipCode} {City}
6. Dependency between attributes belonging to a key
Use
Useyour
yourown
ownjudgment
judgmentwhen
whendecomposing
decomposingschemas
schemas
05/30/21 Sanjay Goel, School of Business, University at 25 of 34
Albany
Normalization
BCNF: Decomposition
Example 2 (Convert to BCNF)
Old Scheme {MovieTitle, StudioID, MovieID, ActorName, Role, Payment }
New Scheme {MovieID, ActorName, Role, Payment}
New Scheme {MovieTitle, StudioID, ActorName}
• Loss of relation {MovieID} {MovieTitle}
New Scheme {MovieID, ActorName, Role, Payment}
New Scheme {MovieID, MovieTitle}
• We got the {MovieID} {MovieTitle} relationship back