3. IntroductionIntroduction
One of the most important steps in designing a database is
ensuring that the data is properly distributed among its
tables. A poorly design database can cripple an application,
producing problems with redundancy, in accuracy,
consistency and concurrency of data. Normalization is a
process that serves to reduce, if not eliminate, these
problems with data.
4. What is Normalization?What is Normalization?
• Normalization is the process of reorganizing data in a
database so that it meets two basic requirements:
(1) There is no redundancy of data (all data is stored in only one place),
and
(2) Data dependencies are logical (all related data items are stored
together).
• Normalization isalso known asdata
normalization.
5. Levels of NormalizationLevels of Normalization
• Levels of normalization based on the amount of
redundancy in thedatabase.
• Variouslevelsof 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)
Redundancy
NumberofTables
Complexity
6. Diagram forlevel ofDiagram forlevel of
NormalizationNormalization
DKNF
1NF
2NF
3NF
4NF
5NF
Each higher level is a subset of the lower levelEach higher level is a subset of the lower level
7. Non-Normalised TableNon-Normalised Table
ID Name Subjects
001231 William Hartnell Information Systems,
Systems Analysis,
Data Communications
001232 Patrick Troughton Systems Analysis,
Data Communications
001233 Jon Pertwee OO Programming,
Systems Analysis,
Data Communications
001234 Tom Baker Systems Analysis,
Data Communications
There is the Non-Normalized Table named : STUDENT
8. First Normal FormFirst Normal Form
Each field contains the smallest
meaningful value.
Thetabledoesnot contain repeating
groupsof fieldsor repeating datawithin
thesamefield.
Create a separate table for each set of related data.
Identify each set of related data with a primary key.
9. First Normal FormFirst Normal Form
• To convert data for unnormalised form to 1NF, simply
convert any repeated attributes into part of the candidate
key.
• STUDENT(ID, Name, Subjects)
• STUDENT(ID, Name, Subjects)
10. This Is The First Normal Form Table:This Is The First Normal Form Table:
ID Name Subjects
001231 William Hartnell Information Systems
001231 William Hartnell Systems Analysis
001231 William Hartnell Data Communications
001232 Patrick Troughton Systems Analysis
001232 Patrick Troughton Data Communications
001233 Jon Pertwee OO Programming
001233 Jon Pertwee Systems Analysis
001233 Jon Pertwee Data Communications
001234 Tom Baker Systems Analysis
001234 Tom Baker Data Communications
11. Second Normal FormSecond Normal Form
• Usually used in tables with a multiple-field primary key
(composite key).
• Each non-key field relates to the entire primary key.
• Any field that does not relate to the primary key is
placed in a separate table.
–MAIN POINT
eliminate redundant data in a table
Create separate tables for sets of values
that apply to multiple records
12. Table for Second Normal FromTable for Second Normal From
RefNo Name Address Status AccNo
345 C.J. Date 23, High Street Business 120768
345 C.J. Date 23, High Street Business 348973
543 F.D. Rolland 45, The Ash Domestic 987654
675 D.R. Howe 17, Low Street Business 745363
675 D.R. Howe 17, Low Street Business 678453
675 D.R. Howe 17, Low Street Business 348973
13. After CompleteAfter Complete Second Normal FormSecond Normal Form
RefNo AccNo
345 120768
345 348973
543 987654
675 745363
675 678453
675 348973
RefNo Name Address Status
345 C.J. Date 23, High Street Business
543 F.D. Rolland 45, The Ash Domestic
675 D.R. Howe 17, Low Street Business
14. Third Normal FromThird Normal From
– Usually used in tables with a single- field
primary key.
– Records do not depend on anything other than
a table's primary key.
– Each non-key field is a fact about the key.
15. Table in Second NormalTable in Second Normal
Form For Third Normal FormForm For Third Normal Form
Branch
Name
Address Manager
No
Acc
No
Balance Type
Rathmines 15 Upr
Rathmimes Road
1234 1205 -£123.45 ‘D’
Rathmines 15 Upr
Rathmimes Road
1234 6784 £67.54 ‘C’
Rathmines 15 Upr
Rathmimes Road
1234 9843 £43.43 ‘C’
Dame St. 1 Dame Street 1101 5422 £34.50 ‘C’
Dame St. 1 Dame Street 1101 0998 £666.66 ‘D’
16. Table in Third Normal FormTable in Third Normal Form
Acc
No
Balance Type Branch
Name
1205 -£123.45 ‘D’ Rathmines
6784 £67.54 ‘C’ Rathmines
9843 £43.43 ‘C’ Rathmines
5422 £34.50 ‘C’ Dame St.
0998 £666.66 ‘D’ Dame St.
Branch
Name
Address Manager
No
Rathmines 15 Upr
Rathmimes Road
1234
Dame St. 1 Dame Street 1101
17. Boyce-Codd NormalBoyce-Codd Normal
FormForm
All attributes in a relation should be dependant upon the key,
the whole key and nothing but the key.
We can used that from find large sorting Attribute.
18. Table in Third Normal FormTable in Third Normal Form
CourseNo Lecturer Time Room
FT225/2 P. O’Byrne 9.00 121
FT222/1 D. Gordon 10.00 666
DT266/2 K. O’Brien 1.00 343
DT266/1 D. Carroll 11.00 876
FT222/4 K. O’Brien 3.00 343
FT228/3 D. Gordon 4.00 666
19. Benefits of Normalization.Benefits of Normalization.
• The database does not have redundant data, it is smaller in
size so less money needs to be spent on storage
• Because there is less data to search through, it is much
faster to run a query on the data
• Because there is no data duplication there is better data
integrity and less risk of mistakes.
20. Complexity Of NormalizationComplexity Of Normalization
• The more tables and the more complex the database, the
slower queries can be to run.
• It is necessary to assign more relationships to interact
with larger numbers of tables.
• With more tables, setting up queries can become more
complex.
21. ACID PropertiesACID Properties
• Atomic
– State shows either all the effects of txn, or none of them
• Consistent
– Txn moves from a state where integrity holds, to another where
integrity holds
• Isolated
– Effect of txns is the same as txns running one after another (ie
looks like batch mode)
• Durable
– Once a txn has committed, its effects remain in the database