SlideShare a Scribd company logo
1 of 32
Database Normalization
MIS 520 – Database Theory
Fall 2001 (Day)
Lecture 4/5/6
• This is the process which allows you to winnow out
redundant data within your database.
• This involves restructuring the tables to successively
meeting higher forms of Normalization.
• A properly normalized database should have the
following characteristics
– Scalar values in each fields
– Absence of redundancy.
– Minimal use of null values.
– Minimal loss of information.
Definition
• Levels of normalization based on the amount of
redundancy in the database.
• Various levels of normalization are:
– First Normal Form (1NF)
– Second Normal Form (2NF)
– Third Normal Form (3NF)
– Boyce-Codd Normal Form (BCNF)
– Fourth Normal Form (4NF)
– Fifth Normal Form (5NF)
– Domain Key Normal Form (DKNF)
Levels of Normalization
Redundancy
NumberofTables
Most databases should be 3NF or BCNF in order to avoid
the database anomalies.
Most databases should be 3NF or BCNF in order to avoid
the database anomalies.
Complexity
Levels of Normalization
Each higher level is a subset of the lower levelEach higher level is a subset of the lower level
DKNF
1NF
2NF
3NF
4NF
5NF
A table is considered to be in 1NF if all the fields contain
only scalar values (as opposed to list of values).
Example (Not 1NF)
First Normal Form (1NF)
Author and AuPhone columns are not scalarAuthor and AuPhone columns are not scalar
0-321-32132-1 Balloon Sleepy,
Snoopy,
Grumpy
321-321-1111,
232-234-1234,
665-235-6532
Small House 714-000-0000 $34.00
0-55-123456-9 Main Street Jones,
Smith
123-333-3333,
654-223-3455
Small House 714-000-0000 $22.95
0-123-45678-0 Ulysses Joyce 666-666-6666 Alpha Press 999-999-9999 $34.00
1-22-233700-0 Visual
Basic
Roman 444-444-4444 Big House 123-456-7890 $25.00
ISBN Title AuName AuPhone PubName PubPhone Price
1. Place all items that appear in the repeating group in a new
table
2. Designate a primary key for each new table produced.
3. Duplicate in the new table the primary key of the table
from which the repeating group was extracted or vice
versa.
Example (1NF)
1NF - Decomposition
0-321-32132-1 Balloon Small House 714-000-0000 $34.00
0-55-123456-9 Main Street Small House 714-000-0000 $22.95
0-123-45678-0 Ulysses Alpha Press 999-999-9999 $34.00
1-22-233700-0 Visual
Basic
Big House 123-456-7890 $25.00
ISBN Title PubName PubPhone Price
ISBN AuName AuPhone
0-123-45678-0 Joyce 666-666-6666
1-22-233700-0 Roman 444-444-4444
0-55-123456-9 Smith 654-223-3455
0-55-123456-9 Jones 123-333-3333
0-321-32132-1 Grumpy 665-235-6532
0-321-32132-1 Snoopy 232-234-1234
0-321-32132-1 Sleepy 321-321-1111
1. If one set of attributes in a table determines another
set of attributes in the table, then the second set of
attributes is said to be functionally dependent on the
first set of attributes.
Example 1
Functional Dependencies
0-321-32132-1 Balloon $34.00
0-55-123456-9 Main Street $22.95
0-123-45678-0 Ulysses $34.00
1-22-233700-0 Visual
Basic
$25.00
ISBN Title Price Table Scheme: {ISBN, Title, Price}
Functional Dependencies: {ISBN} 
{Title}
{ISBN} 
{Price}
Example 2
Functional Dependencies
1 Big House 999-999-9999
2 Small House 123-456-7890
3 Alpha Press 111-111-1111
PubID PubName PubPhone Table Scheme: {PubID, PubName,
PubPhone}
Functional Dependencies: {PubId} 
{PubPhone}
{PubId} 
{PubName}
{PubName, PubPhone} 
{PubID}AuID AuName AuPhone
6 Joyce 666-666-6666
7 Roman 444-444-4444
5 Smith 654-223-3455
4 Jones 123-333-3333
3 Grumpy 665-235-6532
2 Snoopy 232-234-1234
1 Sleepy 321-321-1111
Example 3
Table Scheme: {AuID, AuName,
AuPhone}
Functional Dependencies: {AuId} 
{AuPhone}
{AuId} 
{AuName}
{AuName, AuPhone}  {AuID}
FD – Example
Database to track reviews of papers submitted to an academic
conference. Prospective authors submit papers for review and
possible acceptance in the published conference proceedings.
Details of the entities
– Author information includes a unique author number, a name, a
mailing address, and a unique (optional) email address.
– Paper information includes the primary author, the paper number,
the title, the abstract, and review status (pending,
accepted,rejected)
– Reviewer information includes the reviewer number, the name,
the mailing address, and a unique (optional) email address
– A completed review includes the reviewer number, the date, the
paper number, comments to the authors, comments to the
program chairperson, and ratings (overall, originality, correctness,
style, clarity)
FD – Example
Functional Dependencies
– AuthNo  AuthName, AuthEmail, AuthAddress
– AuthEmail  AuthNo
– PaperNo  Primary-AuthNo, Title, Abstract, Status
– RevNo  RevName, RevEmail, RevAddress
– RevEmail  RevNo
– RevNo, PaperNo  AuthComm, Prog-Comm, Date,
Rating1, Rating2, Rating3, Rating4, Rating5
For a table to be in 2NF, there are two requirements
– The database is in first normal form
– All nonkey attributes in the table must be functionally dependent on the
entire primary key
Note: Remember that we are dealing with non-key attributes
Example 1 (Not 2NF)
Scheme  {Title, PubId, AuId, Price, AuAddress}
1. Key  {Title, PubId, AuId}
2. {Title, PubId, AuID}  {Price}
3. {AuID}  {AuAddress}
4. AuAddress does not belong to a key
5. AuAddress functionally depends on AuId which is a subset
of a key
Second Normal Form (2NF)
Example 2 (Not 2NF)
Scheme  {City, Street, HouseNumber, HouseColor, CityPopulation}
1. key  {City, Street, HouseNumber}
2. {City, Street, HouseNumber}  {HouseColor}
3. {City}  {CityPopulation}
4. CityPopulation does not belong to any key.
5. CityPopulation is functionally dependent on the City which is a
proper subset of the key
Example 3 (Not 2NF)
Scheme  {studio, movie, budget, studio_city}
1. Key  {studio, movie}
2. {studio, movie}  {budget}
3. {studio}  {studio_city}
4. studio_city is not a part of a key
5. studio_city functionally depends on studio which is a proper subset
of the key
Second Normal Form (2NF)
1. If a data item is fully functionally dependent on only a part of the
primary key, move that data item and that part of the primary
key to a new table.
2. If other data items are functionally dependent on the same part
of the key, place them in the new table also
3. Make the partial primary key copied from the original table the
primary key for the new table. Place all items that appear in the
repeating group in a new table
Example 1 (Convert to 2NF)
Old Scheme  {Title, PubId, AuId, Price, AuAddress}
New Scheme  {Title, PubId, AuId, Price}
New Scheme  {AuId, AuAddress}
2NF - Decomposition
Example 2 (Convert to 2NF)
Old Scheme  {Studio, Movie, Budget, StudioCity}
New Scheme  {Movie, Studio, Budget}
New Scheme  {Studio, City}
Example 3 (Convert to 2NF)
Old Scheme  {City, Street, HouseNumber, HouseColor,
CityPopulation}
New Scheme  {City, Street, HouseNumber, HouseColor}
New Scheme  {City, CityPopulation}
2NF - Decomposition
• Concepts of Database Management
– Chapter 5 - Problems 9 & 11
Home Work #2 (Normalization)
• Lecture 7 & Lecture 9 in CETL to work on Access
• Project guidelines are provided
– Students should start the design of their database
Announcement
This form dictates that all non-key attributes of a table must be
functionally dependent on a candidate key i.e. there can be no
interdependencies among non-key attributes.
For a table to be in 3NF, there are two requirements
– The table should be second normal form
– No attribute is transitively dependent on the primary key
Example (Not in 3NF)
Scheme  {Title, PubID, PageCount, Price }
1. Key  {Title, PubId}
2. {Title, PubId}  {PageCount}
3. {PageCount}  {Price}
4. Both Price and PageCount depend on a key hence 2NF
5. Transitively {Title, PubID}  {Price} hence not in 3NF
Third Normal Form (3NF)
Example 2 (Not in 3NF)
Scheme  {Studio, StudioCity, CityTemp}
1. Primary Key  {Studio}
2. {Studio}  {StudioCity}
3. {StudioCity}  {CityTemp}
4. {Studio}  {CityTemp}
5. Both StudioCity and CityTemp depend on the entire key hence 2NF
6. CityTemp transitively depends on Studio hence violates 3NF
Example 3 (Not in 3NF)
Scheme  {BuildingID, Contractor, Fee}
1. Primary Key  {BuildingID}
2. {BuildingID}  {Contractor}
3. {Contractor}  {Fee}
4. {BuildingID}  {Fee}
5. Fee transitively depends on the BuildingID
6. Both Contractor and Fee depend on the entire key hence 2NF
Third Normal Form (3NF)
Building
ID
Contractor Fee
100 Randolp
h
120
0
150 Ingersoll 110
0200 Randolp
h
120
0
250 Pitkin 110
0
300 Randolp
h
120
0
1. Move all items involved in transitive dependencies to a new
entity.
2. Identify a primary key for the new entity.
3. Place the primary key for the new entity as a foreign key on the
original entity.
Example 1 (Convert to 3NF)
Old Scheme  {Title, PubID, PageCount, Price }
New Scheme  {PubID, PageCount, Price}
New Scheme  {Title, PubID, PageCount}
3NF - Decomposition
Example 2 (Convert to 3NF)
Old Scheme  {Studio, StudioCity, CityTemp}
New Scheme  {Studio, StudioCity}
New Scheme  {StudioCity, CityTemp}
Example 3 (Convert to 3NF)
Old Scheme  {BuildingID, Contractor, Fee}
New Scheme  {BuildingID, Contractor}
New Scheme  {Contractor, Fee}
3NF - Decomposition
Building
ID
Contractor
100 Randolp
h
150 Ingersoll
200 Randolp
h
250 Pitkin
300 Randolp
h
Contractor Fee
Randolp
h
120
0
Ingersoll 110
0
Pitkin 110
0
• 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 the 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
Boyce-Codd Normal Form (BCNF)
Example 2 - Movie (Not in BCNF)
Scheme  {MovieTitle, MovieID, PersonName, Role, Payment }
1. Key1  {MovieTitle, PersonName}
2. Key2  {MovieID, PersonName}
3. Both role and payment functionally depend on both candidate keys
thus 3NF
4. {MovieID}  {MovieTitle}
5. Dependency between MovieID & MovieTitle Violates BCNF
Example 3 - Consulting (Not in BCNF)
Scheme  {Client, Problem, Consultant}
1. Key1  {Client, Problem}
2. Key2  {Client, Consultant}
3. No non-key attribute hence 3NF
4. {Client, Problem}  {Consultant}
5. {Client, Consultant}  {Problem}
6. Dependency between attributess belonging to keys violates BCNF
Boyce Codd Normal Form (BCNF)
1. Place the two candidate primary keys in separate
entities
2. Place each of the remaining data items in one of the
resulting entities according to its dependency on the
primary key.
Example 1 (Convert to BCNF)
Old Scheme  {City, Street, ZipCode }
New Scheme1  {ZipCode, Street}
New Scheme2  {City, Street}
• Loss of relation {ZipCode}  {City}
Alternate New Scheme1  {ZipCode, Street }
Alternate New Scheme2  {ZipCode, City}
BCNF - Decomposition
1. If decomposition does not cause any loss of information it is
called a lossless decomposition.
2. If a decomposition does not cause any dependencies to be lost
it is called a dependency-preserving decomposition.
3. Any table scheme can be decomposed in a lossless way into a
collection of smaller schemas that are in BCNF form. However
the dependency preservation is not guaranteed.
4. Any table can be decomposed in a lossless way into 3rd
normal
form that also preserves the dependencies.
• 3NF may be better than BCNF in some cases
Decomposition – Loss of
Information
Use your own judgment when decomposing schemasUse your own judgment when decomposing schemas
Example 2 (Convert to BCNF)
Old Scheme  {MovieTitle, MovieID, PersonName, Role, Payment }
New Scheme  {MovieID, PersonName, Role, Payment}
New Scheme  {MovieTitle, PersonName}
• Loss of relation {MovieID}  {MovieTitle}
New Scheme  {MovieID, PersonName, Role, Payment}
New Scheme  {MovieID, MovieTitle}
• We got the {MovieID}  {MovieTitle} relationship back
Example 3 (Convert to BCNF)
Old Scheme  {Client, Problem, Consultant}
New Scheme  {Client, Consultant}
New Scheme  {Client, Problem}
BCNF - Decomposition
• Fourth normal form eliminates independent many-to-one
relationships between columns.
• To be in Fourth Normal Form,
– a relation must first be in Boyce-Codd Normal Form. 
– a given relation may not contain more than one multi-valued
attribute.
Example (Not in 4NF)
Scheme  {MovieName, ScreeningCity, Genre)
Primary Key: {MovieName, ScreeningCity, Genre)
1. All columns are a part of the only candidate key, hence
BCNF
2. Many Movies can have the same Genre
3. Many Cities can have the same movie
4. Violates 4NF
Fourth Normal Form (4NF)
 
Movie ScreeningC
ity
Genre
Hard Code Los Angles Comedy
Hard Code New York Comedy
Bill Durham Santa Cruz Drama
Bill Durham Durham Drama
The Code Warrier New York Horror
Example 2 (Not in 4NF)
Scheme  {Manager, Child, Employee}
1. Primary Key  {Manager, Child, Employee}
2. Each manager can have more than one child
3. Each manager can supervise more than one employee
4. 4NF Violated
Example 3 (Not in 4NF)
Scheme  {Employee, Skill, ForeignLanguage}
1. Primary Key  {Employee, Skill, Language }
2. Each employee can speak multiple languages
3. Each employee can have multiple skills
4. Thus violates 4NF
Fourth Normal Form (4NF)
Manage
r
Child
    
Employe
e
Jim Beth Alice
Mary Bob Jane
Mary NULL Adam
Employ
ee
Skill Langua
ge
1234 Cooking French
1234 Cooking German
1453 Carpentry Spanish
1453 Cooking Spanish
2345 Cooking Spanish
1. Move the two multi-valued relations to separate tables
2. Identify a primary key for each of the new entity.
Example 1 (Convert to 3NF)
Old Scheme  {MovieName, ScreeningCity, Genre}
New Scheme  {MovieName, ScreeningCity}
New Scheme  {MovieName, Genre}
4NF - Decomposition
Movie Genre
Hard Code Comedy
Bill Durham Drama
The Code Warrier Horror
Movie ScreeningC
ity
Hard Code Los Angles
Hard Code New York
Bill Durham Santa Cruz
Bill Durham Durham
The Code Warrier New York
Example 2 (Convert to 4NF)
Old Scheme  {Manager, Child, Employee}
New Scheme  {Manager, Child}
New Scheme  {Manager, Employee}
Example 3 (Convert to 4NF)
Old Scheme  {Employee, Skill, ForeignLanguage}
New Scheme  {Employee, Skill}
New Scheme  {Employee, ForeignLanguage}
4NF - Decomposition
Manage
r
Child
    
Jim Beth
Mary Bob
Manage
r
Employe
e
Jim Alice
Mary Jane
Mary Adam
Employ
ee
Langua
ge
1234 French
1234 German
1453 Spanish
2345 Spanish
Employ
ee
Skill
1234 Cooking
1453 Carpentry
1453 Cooking
2345 Cooking
• Fifth normal form is satisfied when all tables are
broken into as many tables as possible in order
to avoid redundancy. Once it is in fifth normal
form it cannot be broken into smaller relations
without changing the facts or the meaning. 
Fifth Normal Form (5NF)
 
• The relation is in DKNF when there can be no
insertion or deletion anomalies in the database.
Domain Key Normal Form (DKNF)
 
• Make Teams
• Slides are on the web site in pdf format
Announcement

More Related Content

What's hot (20)

Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)
 
Normalization in a Database
Normalization in a DatabaseNormalization in a Database
Normalization in a Database
 
Databases: Normalisation
Databases: NormalisationDatabases: Normalisation
Databases: Normalisation
 
Normalization PRESENTATION
Normalization PRESENTATIONNormalization PRESENTATION
Normalization PRESENTATION
 
Normalization
NormalizationNormalization
Normalization
 
File Management in Operating System
File Management in Operating SystemFile Management in Operating System
File Management in Operating System
 
Date and time functions in mysql
Date and time functions in mysqlDate and time functions in mysql
Date and time functions in mysql
 
normaliztion
normaliztionnormaliztion
normaliztion
 
Normalization in SQL | Edureka
Normalization in SQL | EdurekaNormalization in SQL | Edureka
Normalization in SQL | Edureka
 
Normalization of database tables
Normalization of database tablesNormalization of database tables
Normalization of database tables
 
3 Level Architecture
3 Level Architecture3 Level Architecture
3 Level Architecture
 
Normalization
NormalizationNormalization
Normalization
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Indexes and Indexing in Oracle 12c
Indexes and Indexing in Oracle 12cIndexes and Indexing in Oracle 12c
Indexes and Indexing in Oracle 12c
 
Bcnf
BcnfBcnf
Bcnf
 
Normalization
NormalizationNormalization
Normalization
 
Normalisation and anomalies
Normalisation and anomaliesNormalisation and anomalies
Normalisation and anomalies
 
File system structure
File system structureFile system structure
File system structure
 
A Quick Introduction to Linux
A Quick Introduction to LinuxA Quick Introduction to Linux
A Quick Introduction to Linux
 

Viewers also liked

Mca ii-dbms-u-v-transaction management
Mca ii-dbms-u-v-transaction managementMca ii-dbms-u-v-transaction management
Mca ii-dbms-u-v-transaction managementRai University
 
Directed Acyclic Graph
Directed Acyclic Graph Directed Acyclic Graph
Directed Acyclic Graph AJAL A J
 
SQL Server Transaction Management
SQL Server Transaction ManagementSQL Server Transaction Management
SQL Server Transaction ManagementMark Ginnebaugh
 
Mca ii-dbms- u-i-introductory concepts of dbms
Mca ii-dbms- u-i-introductory concepts of dbmsMca ii-dbms- u-i-introductory concepts of dbms
Mca ii-dbms- u-i-introductory concepts of dbmsRai University
 
The dag representation of basic blocks
The dag representation of basic blocksThe dag representation of basic blocks
The dag representation of basic blocksShabeen Taj
 
Hybrid Cloud Computing (IBM System z)
Hybrid Cloud Computing (IBM System z)Hybrid Cloud Computing (IBM System z)
Hybrid Cloud Computing (IBM System z)IBM Danmark
 
code optimization
code optimization code optimization
code optimization Sanjeev Raaz
 
Code generator
Code generatorCode generator
Code generatorTech_MX
 
Peephole optimization techniques in compiler design
Peephole optimization techniques in compiler designPeephole optimization techniques in compiler design
Peephole optimization techniques in compiler designAnul Chaudhary
 
Three address code In Compiler Design
Three address code In Compiler DesignThree address code In Compiler Design
Three address code In Compiler DesignShine Raj
 
Database Management Systems (DBMS)
Database Management Systems (DBMS)Database Management Systems (DBMS)
Database Management Systems (DBMS)Dimara Hakim
 

Viewers also liked (19)

Ch8
Ch8Ch8
Ch8
 
Ch1 intro
Ch1 introCh1 intro
Ch1 intro
 
Mca ii-dbms-u-v-transaction management
Mca ii-dbms-u-v-transaction managementMca ii-dbms-u-v-transaction management
Mca ii-dbms-u-v-transaction management
 
Normalization
NormalizationNormalization
Normalization
 
Directed Acyclic Graph
Directed Acyclic Graph Directed Acyclic Graph
Directed Acyclic Graph
 
SQL Server Transaction Management
SQL Server Transaction ManagementSQL Server Transaction Management
SQL Server Transaction Management
 
Code optimization
Code optimizationCode optimization
Code optimization
 
Mca ii-dbms- u-i-introductory concepts of dbms
Mca ii-dbms- u-i-introductory concepts of dbmsMca ii-dbms- u-i-introductory concepts of dbms
Mca ii-dbms- u-i-introductory concepts of dbms
 
The dag representation of basic blocks
The dag representation of basic blocksThe dag representation of basic blocks
The dag representation of basic blocks
 
Hybrid Cloud Computing (IBM System z)
Hybrid Cloud Computing (IBM System z)Hybrid Cloud Computing (IBM System z)
Hybrid Cloud Computing (IBM System z)
 
code optimization
code optimization code optimization
code optimization
 
Code Generation
Code GenerationCode Generation
Code Generation
 
Code generator
Code generatorCode generator
Code generator
 
Normalization
NormalizationNormalization
Normalization
 
Peephole optimization techniques in compiler design
Peephole optimization techniques in compiler designPeephole optimization techniques in compiler design
Peephole optimization techniques in compiler design
 
Three address code In Compiler Design
Three address code In Compiler DesignThree address code In Compiler Design
Three address code In Compiler Design
 
DBMS - Normalization
DBMS - NormalizationDBMS - Normalization
DBMS - Normalization
 
Dbms
DbmsDbms
Dbms
 
Database Management Systems (DBMS)
Database Management Systems (DBMS)Database Management Systems (DBMS)
Database Management Systems (DBMS)
 

Similar to Normalization

Similar to Normalization (20)

Normalization
NormalizationNormalization
Normalization
 
Database Normalization.ppt
Database Normalization.pptDatabase Normalization.ppt
Database Normalization.ppt
 
normalization.ppt
normalization.pptnormalization.ppt
normalization.ppt
 
normalization-Normalization -Process of Divide Tables
normalization-Normalization -Process of Divide Tablesnormalization-Normalization -Process of Divide Tables
normalization-Normalization -Process of Divide Tables
 
normalization in Database Management Systems.ppt
normalization in Database Management Systems.pptnormalization in Database Management Systems.ppt
normalization in Database Management Systems.ppt
 
normalization.ppt
normalization.pptnormalization.ppt
normalization.ppt
 
normalization.ppt
normalization.pptnormalization.ppt
normalization.ppt
 
Mca ii-dbms-u-iv-structured query language
Mca ii-dbms-u-iv-structured query languageMca ii-dbms-u-iv-structured query language
Mca ii-dbms-u-iv-structured query language
 
Bsc cs ii-dbms-u-iv-normalization
Bsc cs ii-dbms-u-iv-normalizationBsc cs ii-dbms-u-iv-normalization
Bsc cs ii-dbms-u-iv-normalization
 
Normalization
NormalizationNormalization
Normalization
 
Normalization.ppt
Normalization.pptNormalization.ppt
Normalization.ppt
 
Normalization
NormalizationNormalization
Normalization
 
Lecture8 Normalization Aggarwal
Lecture8 Normalization AggarwalLecture8 Normalization Aggarwal
Lecture8 Normalization Aggarwal
 
Chuẩn hóa CSDL
Chuẩn hóa CSDLChuẩn hóa CSDL
Chuẩn hóa CSDL
 
Normalization case
Normalization caseNormalization case
Normalization case
 
Normalisation revision
Normalisation revisionNormalisation revision
Normalisation revision
 
What is New in DMN 1.4
What is New in DMN 1.4What is New in DMN 1.4
What is New in DMN 1.4
 
Revision1510(1)
Revision1510(1)Revision1510(1)
Revision1510(1)
 
Unit 3 dbms
Unit 3 dbmsUnit 3 dbms
Unit 3 dbms
 
Cooking Cassandra
Cooking CassandraCooking Cassandra
Cooking Cassandra
 

Recently uploaded

Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 

Recently uploaded (20)

Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 

Normalization

  • 1. Database Normalization MIS 520 – Database Theory Fall 2001 (Day) Lecture 4/5/6
  • 2. • This is the process which allows you to winnow out redundant data within your database. • This involves restructuring the tables to successively meeting higher forms of Normalization. • A properly normalized database should have the following characteristics – Scalar values in each fields – Absence of redundancy. – Minimal use of null values. – Minimal loss of information. Definition
  • 3. • Levels of normalization based on the amount of redundancy in the database. • Various levels of normalization are: – First Normal Form (1NF) – Second Normal Form (2NF) – Third Normal Form (3NF) – Boyce-Codd Normal Form (BCNF) – Fourth Normal Form (4NF) – Fifth Normal Form (5NF) – Domain Key Normal Form (DKNF) Levels of Normalization Redundancy NumberofTables Most databases should be 3NF or BCNF in order to avoid the database anomalies. Most databases should be 3NF or BCNF in order to avoid the database anomalies. Complexity
  • 4. Levels of Normalization Each higher level is a subset of the lower levelEach higher level is a subset of the lower level DKNF 1NF 2NF 3NF 4NF 5NF
  • 5. A table is considered to be in 1NF if all the fields contain only scalar values (as opposed to list of values). Example (Not 1NF) First Normal Form (1NF) Author and AuPhone columns are not scalarAuthor and AuPhone columns are not scalar 0-321-32132-1 Balloon Sleepy, Snoopy, Grumpy 321-321-1111, 232-234-1234, 665-235-6532 Small House 714-000-0000 $34.00 0-55-123456-9 Main Street Jones, Smith 123-333-3333, 654-223-3455 Small House 714-000-0000 $22.95 0-123-45678-0 Ulysses Joyce 666-666-6666 Alpha Press 999-999-9999 $34.00 1-22-233700-0 Visual Basic Roman 444-444-4444 Big House 123-456-7890 $25.00 ISBN Title AuName AuPhone PubName PubPhone Price
  • 6. 1. Place all items that appear in the repeating group in a new table 2. Designate a primary key for each new table produced. 3. Duplicate in the new table the primary key of the table from which the repeating group was extracted or vice versa. Example (1NF) 1NF - Decomposition 0-321-32132-1 Balloon Small House 714-000-0000 $34.00 0-55-123456-9 Main Street Small House 714-000-0000 $22.95 0-123-45678-0 Ulysses Alpha Press 999-999-9999 $34.00 1-22-233700-0 Visual Basic Big House 123-456-7890 $25.00 ISBN Title PubName PubPhone Price ISBN AuName AuPhone 0-123-45678-0 Joyce 666-666-6666 1-22-233700-0 Roman 444-444-4444 0-55-123456-9 Smith 654-223-3455 0-55-123456-9 Jones 123-333-3333 0-321-32132-1 Grumpy 665-235-6532 0-321-32132-1 Snoopy 232-234-1234 0-321-32132-1 Sleepy 321-321-1111
  • 7. 1. If one set of attributes in a table determines another set of attributes in the table, then the second set of attributes is said to be functionally dependent on the first set of attributes. Example 1 Functional Dependencies 0-321-32132-1 Balloon $34.00 0-55-123456-9 Main Street $22.95 0-123-45678-0 Ulysses $34.00 1-22-233700-0 Visual Basic $25.00 ISBN Title Price Table Scheme: {ISBN, Title, Price} Functional Dependencies: {ISBN}  {Title} {ISBN}  {Price}
  • 8. Example 2 Functional Dependencies 1 Big House 999-999-9999 2 Small House 123-456-7890 3 Alpha Press 111-111-1111 PubID PubName PubPhone Table Scheme: {PubID, PubName, PubPhone} Functional Dependencies: {PubId}  {PubPhone} {PubId}  {PubName} {PubName, PubPhone}  {PubID}AuID AuName AuPhone 6 Joyce 666-666-6666 7 Roman 444-444-4444 5 Smith 654-223-3455 4 Jones 123-333-3333 3 Grumpy 665-235-6532 2 Snoopy 232-234-1234 1 Sleepy 321-321-1111 Example 3 Table Scheme: {AuID, AuName, AuPhone} Functional Dependencies: {AuId}  {AuPhone} {AuId}  {AuName} {AuName, AuPhone}  {AuID}
  • 9. FD – Example Database to track reviews of papers submitted to an academic conference. Prospective authors submit papers for review and possible acceptance in the published conference proceedings. Details of the entities – Author information includes a unique author number, a name, a mailing address, and a unique (optional) email address. – Paper information includes the primary author, the paper number, the title, the abstract, and review status (pending, accepted,rejected) – Reviewer information includes the reviewer number, the name, the mailing address, and a unique (optional) email address – A completed review includes the reviewer number, the date, the paper number, comments to the authors, comments to the program chairperson, and ratings (overall, originality, correctness, style, clarity)
  • 10. FD – Example Functional Dependencies – AuthNo  AuthName, AuthEmail, AuthAddress – AuthEmail  AuthNo – PaperNo  Primary-AuthNo, Title, Abstract, Status – RevNo  RevName, RevEmail, RevAddress – RevEmail  RevNo – RevNo, PaperNo  AuthComm, Prog-Comm, Date, Rating1, Rating2, Rating3, Rating4, Rating5
  • 11. For a table to be in 2NF, there are two requirements – The database is in first normal form – All nonkey attributes in the table must be functionally dependent on the entire primary key Note: Remember that we are dealing with non-key attributes Example 1 (Not 2NF) Scheme  {Title, PubId, AuId, Price, AuAddress} 1. Key  {Title, PubId, AuId} 2. {Title, PubId, AuID}  {Price} 3. {AuID}  {AuAddress} 4. AuAddress does not belong to a key 5. AuAddress functionally depends on AuId which is a subset of a key Second Normal Form (2NF)
  • 12. Example 2 (Not 2NF) Scheme  {City, Street, HouseNumber, HouseColor, CityPopulation} 1. key  {City, Street, HouseNumber} 2. {City, Street, HouseNumber}  {HouseColor} 3. {City}  {CityPopulation} 4. CityPopulation does not belong to any key. 5. CityPopulation is functionally dependent on the City which is a proper subset of the key Example 3 (Not 2NF) Scheme  {studio, movie, budget, studio_city} 1. Key  {studio, movie} 2. {studio, movie}  {budget} 3. {studio}  {studio_city} 4. studio_city is not a part of a key 5. studio_city functionally depends on studio which is a proper subset of the key Second Normal Form (2NF)
  • 13. 1. If a data item is fully functionally dependent on only a part of the primary key, move that data item and that part of the primary key to a new table. 2. If other data items are functionally dependent on the same part of the key, place them in the new table also 3. Make the partial primary key copied from the original table the primary key for the new table. Place all items that appear in the repeating group in a new table Example 1 (Convert to 2NF) Old Scheme  {Title, PubId, AuId, Price, AuAddress} New Scheme  {Title, PubId, AuId, Price} New Scheme  {AuId, AuAddress} 2NF - Decomposition
  • 14. Example 2 (Convert to 2NF) Old Scheme  {Studio, Movie, Budget, StudioCity} New Scheme  {Movie, Studio, Budget} New Scheme  {Studio, City} Example 3 (Convert to 2NF) Old Scheme  {City, Street, HouseNumber, HouseColor, CityPopulation} New Scheme  {City, Street, HouseNumber, HouseColor} New Scheme  {City, CityPopulation} 2NF - Decomposition
  • 15. • Concepts of Database Management – Chapter 5 - Problems 9 & 11 Home Work #2 (Normalization)
  • 16. • Lecture 7 & Lecture 9 in CETL to work on Access • Project guidelines are provided – Students should start the design of their database Announcement
  • 17. This form dictates that all non-key attributes of a table must be functionally dependent on a candidate key i.e. there can be no interdependencies among non-key attributes. For a table to be in 3NF, there are two requirements – The table should be second normal form – No attribute is transitively dependent on the primary key Example (Not in 3NF) Scheme  {Title, PubID, PageCount, Price } 1. Key  {Title, PubId} 2. {Title, PubId}  {PageCount} 3. {PageCount}  {Price} 4. Both Price and PageCount depend on a key hence 2NF 5. Transitively {Title, PubID}  {Price} hence not in 3NF Third Normal Form (3NF)
  • 18. Example 2 (Not in 3NF) Scheme  {Studio, StudioCity, CityTemp} 1. Primary Key  {Studio} 2. {Studio}  {StudioCity} 3. {StudioCity}  {CityTemp} 4. {Studio}  {CityTemp} 5. Both StudioCity and CityTemp depend on the entire key hence 2NF 6. CityTemp transitively depends on Studio hence violates 3NF Example 3 (Not in 3NF) Scheme  {BuildingID, Contractor, Fee} 1. Primary Key  {BuildingID} 2. {BuildingID}  {Contractor} 3. {Contractor}  {Fee} 4. {BuildingID}  {Fee} 5. Fee transitively depends on the BuildingID 6. Both Contractor and Fee depend on the entire key hence 2NF Third Normal Form (3NF) Building ID Contractor Fee 100 Randolp h 120 0 150 Ingersoll 110 0200 Randolp h 120 0 250 Pitkin 110 0 300 Randolp h 120 0
  • 19. 1. Move all items involved in transitive dependencies to a new entity. 2. Identify a primary key for the new entity. 3. Place the primary key for the new entity as a foreign key on the original entity. Example 1 (Convert to 3NF) Old Scheme  {Title, PubID, PageCount, Price } New Scheme  {PubID, PageCount, Price} New Scheme  {Title, PubID, PageCount} 3NF - Decomposition
  • 20. Example 2 (Convert to 3NF) Old Scheme  {Studio, StudioCity, CityTemp} New Scheme  {Studio, StudioCity} New Scheme  {StudioCity, CityTemp} Example 3 (Convert to 3NF) Old Scheme  {BuildingID, Contractor, Fee} New Scheme  {BuildingID, Contractor} New Scheme  {Contractor, Fee} 3NF - Decomposition Building ID Contractor 100 Randolp h 150 Ingersoll 200 Randolp h 250 Pitkin 300 Randolp h Contractor Fee Randolp h 120 0 Ingersoll 110 0 Pitkin 110 0
  • 21. • 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 the 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 Boyce-Codd Normal Form (BCNF)
  • 22. Example 2 - Movie (Not in BCNF) Scheme  {MovieTitle, MovieID, PersonName, Role, Payment } 1. Key1  {MovieTitle, PersonName} 2. Key2  {MovieID, PersonName} 3. Both role and payment functionally depend on both candidate keys thus 3NF 4. {MovieID}  {MovieTitle} 5. Dependency between MovieID & MovieTitle Violates BCNF Example 3 - Consulting (Not in BCNF) Scheme  {Client, Problem, Consultant} 1. Key1  {Client, Problem} 2. Key2  {Client, Consultant} 3. No non-key attribute hence 3NF 4. {Client, Problem}  {Consultant} 5. {Client, Consultant}  {Problem} 6. Dependency between attributess belonging to keys violates BCNF Boyce Codd Normal Form (BCNF)
  • 23. 1. Place the two candidate primary keys in separate entities 2. Place each of the remaining data items in one of the resulting entities according to its dependency on the primary key. Example 1 (Convert to BCNF) Old Scheme  {City, Street, ZipCode } New Scheme1  {ZipCode, Street} New Scheme2  {City, Street} • Loss of relation {ZipCode}  {City} Alternate New Scheme1  {ZipCode, Street } Alternate New Scheme2  {ZipCode, City} BCNF - Decomposition
  • 24. 1. If decomposition does not cause any loss of information it is called a lossless decomposition. 2. If a decomposition does not cause any dependencies to be lost it is called a dependency-preserving decomposition. 3. Any table scheme can be decomposed in a lossless way into a collection of smaller schemas that are in BCNF form. However the dependency preservation is not guaranteed. 4. Any table can be decomposed in a lossless way into 3rd normal form that also preserves the dependencies. • 3NF may be better than BCNF in some cases Decomposition – Loss of Information Use your own judgment when decomposing schemasUse your own judgment when decomposing schemas
  • 25. Example 2 (Convert to BCNF) Old Scheme  {MovieTitle, MovieID, PersonName, Role, Payment } New Scheme  {MovieID, PersonName, Role, Payment} New Scheme  {MovieTitle, PersonName} • Loss of relation {MovieID}  {MovieTitle} New Scheme  {MovieID, PersonName, Role, Payment} New Scheme  {MovieID, MovieTitle} • We got the {MovieID}  {MovieTitle} relationship back Example 3 (Convert to BCNF) Old Scheme  {Client, Problem, Consultant} New Scheme  {Client, Consultant} New Scheme  {Client, Problem} BCNF - Decomposition
  • 26. • Fourth normal form eliminates independent many-to-one relationships between columns. • To be in Fourth Normal Form, – a relation must first be in Boyce-Codd Normal Form.  – a given relation may not contain more than one multi-valued attribute. Example (Not in 4NF) Scheme  {MovieName, ScreeningCity, Genre) Primary Key: {MovieName, ScreeningCity, Genre) 1. All columns are a part of the only candidate key, hence BCNF 2. Many Movies can have the same Genre 3. Many Cities can have the same movie 4. Violates 4NF Fourth Normal Form (4NF)   Movie ScreeningC ity Genre Hard Code Los Angles Comedy Hard Code New York Comedy Bill Durham Santa Cruz Drama Bill Durham Durham Drama The Code Warrier New York Horror
  • 27. Example 2 (Not in 4NF) Scheme  {Manager, Child, Employee} 1. Primary Key  {Manager, Child, Employee} 2. Each manager can have more than one child 3. Each manager can supervise more than one employee 4. 4NF Violated Example 3 (Not in 4NF) Scheme  {Employee, Skill, ForeignLanguage} 1. Primary Key  {Employee, Skill, Language } 2. Each employee can speak multiple languages 3. Each employee can have multiple skills 4. Thus violates 4NF Fourth Normal Form (4NF) Manage r Child      Employe e Jim Beth Alice Mary Bob Jane Mary NULL Adam Employ ee Skill Langua ge 1234 Cooking French 1234 Cooking German 1453 Carpentry Spanish 1453 Cooking Spanish 2345 Cooking Spanish
  • 28. 1. Move the two multi-valued relations to separate tables 2. Identify a primary key for each of the new entity. Example 1 (Convert to 3NF) Old Scheme  {MovieName, ScreeningCity, Genre} New Scheme  {MovieName, ScreeningCity} New Scheme  {MovieName, Genre} 4NF - Decomposition Movie Genre Hard Code Comedy Bill Durham Drama The Code Warrier Horror Movie ScreeningC ity Hard Code Los Angles Hard Code New York Bill Durham Santa Cruz Bill Durham Durham The Code Warrier New York
  • 29. Example 2 (Convert to 4NF) Old Scheme  {Manager, Child, Employee} New Scheme  {Manager, Child} New Scheme  {Manager, Employee} Example 3 (Convert to 4NF) Old Scheme  {Employee, Skill, ForeignLanguage} New Scheme  {Employee, Skill} New Scheme  {Employee, ForeignLanguage} 4NF - Decomposition Manage r Child      Jim Beth Mary Bob Manage r Employe e Jim Alice Mary Jane Mary Adam Employ ee Langua ge 1234 French 1234 German 1453 Spanish 2345 Spanish Employ ee Skill 1234 Cooking 1453 Carpentry 1453 Cooking 2345 Cooking
  • 30. • Fifth normal form is satisfied when all tables are broken into as many tables as possible in order to avoid redundancy. Once it is in fifth normal form it cannot be broken into smaller relations without changing the facts or the meaning.  Fifth Normal Form (5NF)  
  • 31. • The relation is in DKNF when there can be no insertion or deletion anomalies in the database. Domain Key Normal Form (DKNF)  
  • 32. • Make Teams • Slides are on the web site in pdf format Announcement

Editor's Notes

  1. <number>
  2. <number>
  3. <number>
  4. <number> Having scalar values also means that all instances of a record type must contain the same number of fields. A table not in first normal form is called un normalized
  5. <number> 1. The designated key will be the primary key of the original table concatenated with one or more data items from the new table. For the first table the primary key is ISBN For the second table the primary key is ISBN + Author Name
  6. <number> Notes to Instructor: Need more rigor in the functional dependencies. With a few examples. May be create a class assignment for functional dependencies.
  7. <number>
  8. <number>
  9. <number>
  10. <number>
  11. <number> Let us consider the problems with the movie studio database: Redundancy – City Population is repeated many times Insertion anomaly – Whenever we add a new record we have to add unnecessary information. We can not add record until we know information about the city population Deletion anomaly – Whenever we delete a record, useful information is deleted. Update anomaly – The City Population needs to be updated in more than one location if it changes.
  12. <number> If there is a table with columns A,B,C,D with Primary Key (A,B) & D is dependant on A (alone) then to be 2NF, you should reduce (split) tables as: Table with columns A,D with Primary Key (A) Table with columns A,B,C with Primary Key (A,B)
  13. <number>
  14. <number>
  15. <number>
  16. <number> In the Book Schema Third Normal Form is violated since a non-key field is dependent on another non-key field and is transitively dependent on the primary key.
  17. <number> Let us consider the problems with the movie studio database: Redundancy – City Population is repeated many times Insertion anomaly – Whenever we add a new record we have to add unnecessary information. We can not add record until we know information about the city population Deletion anomaly – Whenever we delete a record, useful information is deleted. Update anomaly – The City Population needs to be updated in more than one location if it changes.
  18. <number> If there is a table with columns A,B,C with Primary Key (A) and C is dependant on B (B  C) then to be 3NF, the tables become Table with columns B,C with Primary Key (B) Table with fields A,B with Primary Key ( A), and Foreign Key (B)
  19. <number>
  20. <number> The second and third normal forms assume that all attributes not part of the candidate keys depend on the candidate keys but does not deal with dependencies within the keys. BCNF deals with such dependencies. Under third normal form all non-key columns must be functionally dependent on a candidate key. Under BCNF, even columns that are part of a candidate key must be dependent on another candidate key, if they have a dependency at all. For most tables third normal form and BCNF are the same. Third normal form does not cover some specific cases for which BCNF was created. Third normal form and BCNF are not same if the 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
  21. <number> A management consulting firm has several clients and consultants. A client can have several problems and the same problem can be an issue for several clients. Each consultant specializes in only one problem type (e. g marketing, production) but several consultants could advise on one problem. For each problem, the client is advised by only one consultant.
  22. <number> If there is a table with columns A,B,C with Primary Key (A) and C is dependant on B (B  C) then to be 3NF, the tables become Table with columns B,C with Primary Key (B) Table with fields A,B with Primary Key ( A), and Foreign Key (B)
  23. <number>
  24. <number>
  25. <number>
  26. <number> These cause update, addition and deletion anomalies. Insertion anomaly is that entity integrity would be violated if you tried to add a new employee who did not speak a foreign language. Update anomalies would occur if you tried to change Cooking to Chef.
  27. <number>
  28. <number>
  29. <number>
  30. <number>
  31. <number>