0% found this document useful (0 votes)
69 views32 pages

12th Databases

1) Normalization is the process of organizing data in a database to minimize redundancy and dependency. 2) There are several forms of normalization including 1NF, 2NF, 3NF which aim to reduce redundancy and update anomalies by decomposing tables. 3) The first normal form ensures each field contains a single value and the table contains only one type of data. Higher normal forms like 2NF and 3NF further reduce functional dependencies between columns.

Uploaded by

Umar Arshad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views32 pages

12th Databases

1) Normalization is the process of organizing data in a database to minimize redundancy and dependency. 2) There are several forms of normalization including 1NF, 2NF, 3NF which aim to reduce redundancy and update anomalies by decomposing tables. 3) The first normal form ensures each field contains a single value and the table contains only one type of data. Higher normal forms like 2NF and 3NF further reduce functional dependencies between columns.

Uploaded by

Umar Arshad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 32

Normalization

Concepts
Database Designing

• Designing database is a tricky job. Several rules can be applied to


make it simpler. If we apply them correctly, data can be stored,
updated, and retrieved most efficiently.
Problems with database
The problem of database design deals with fitting of a given piece of
data into an appropriate logical organization. Several factors need to be
considered during the process, some of which are as follows.

• How many tables should we have?


• How should they be inter-related?
• How many columns should each table have?
• Which columns should be key column?
• What sort of constraints should we have?
Functional dependency
• Column B is said to be functionally dependent on column A if, given A we can
precisely determine B.

Emp-ID Emp-Name Age


A101 Asad 17
A102 Zain 15
A103 Moazzam 17

Emp-ID Emp-Name
Emp-ID functionally determines Emp-Name
Database Physical and Logical Design
• Physical design refers to the organization of data on the disk.
• Logical Design refer to the design of the tables, their inter-relationship, and key
definition.
• Database Redundancy: Information may be repeated unnecessarily in several
tuples. Unwanted and uncontrolled duplication of data, loss of data integrity and
data consistency.
• Anomalies: Redundancy occur when we try to cram too much into a single
relation are called anomalies.
• Update Anomaly: we may change information in one tuple but leave the same
information unchanged in another.
• Deletion Anomaly: if a set of values become empty, we may lose other
information as a side effect.
Decomposition

Roll-No Stu-Name Subject-Code Subject-Name Marks


A101 Ali S1 Eng 80
A101 Ali S2 Phy 56
A101 Ali S3 Chem 63
A102 Hamza S1 Eng 78
A102 Hamza S2 Chem 39
A102 Hamza S3 Bio 91
Decomposition
• Best way to remove redundancy : keep one fact in one place.

Roll-No Roll-No
Stu-Name Stu-Name
Sub-Code 
Sub-Name Sub-Code
Marks Sub-name
Marks

• Decomposition can not be used for redundancy, if it leads to loss of information.


Recomposition
• After decomposition, we can reassemble the data in the original form- a process
called recomposition. I we are unable to take back the original form of data, it
means that we have lost some of the information from the original database.

• If we are able to successfully reassemble the split tables so that we can recreate
the original data, then the decomposition is desirable and successful.
Data Integration and Data
Redundancy

• Data integration - the ability to tie together pieces of related data


within an information system.
• Data redundancy - the same fact about the business environment is
stored more than once within an information system.
Data Redundancy Problems

• Redundant data takes up a great deal of extra disk space.

• If the redundant data has to be updated, it takes additional time to do


so. This can be a major performance issue.

• There is the potential for data integrity problems.


Data Integrity
• Refers to the accuracy of the data.
• Inaccurate data leaves the whole information system of limited value.

When all copies of redundant data are not updated consistently, a data integrity problem exists.
Anomalies
• Typically occur in poorly structured files.

• Problems arise when two different kinds of data, like salesperson and
customer data are merged into one file.
• Normalization is the way to avoid Anomalies.
Normalization

• Normalization is the process of successive reduction of a given set of relations to


a better form.

• normalization is not fully different from decomposition. The only difference


between two is that decomposition does not abide by any formal rules, where
as Normalization does.
Normalization
• This is the process which allows you to remove 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
• Atomic value in each fields
• Absence of redundancy.
• Minimal use of null values.
• Minimal loss of information.
Levels of Normalization

• Levels of normalization based on the amount of redundancy in the


database.
• Various levels of normalization are:

Number of Tables
First Normal Form (1NF)

Redundancy

Complexity
• 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)
First Normalization Form (1NF)
A table is in the first normal form (1NF) if
• It does not contain any repeating columns
• It Contain only atomic value.
1st Normalization Decomposition
After First Normalization
Students Knowledge Area
StuID FirstName LastName StuID FirstName Knowledge

Sap-1 Thomas Mueller Sap-1 Thomas C++

Sap-2 Ursula Meier Sap-1 Thomas PHP

Sap-3 Igor Mueller Sap-1 Thomas Java

Sap-2 Ursula Java

Sap-2 Ursula PHP

Sap-3 Igor Java

Sap-3 Igor C++


1NF
Result of 1NF
Example 1NF Exercise
Solution 1NF
2NF (Second Normalization Form)
A table or database is in 2NF if
• It is in 1NF, and
• If all non-key columns in the table should fully functionally dependent on the
primary key.
• A table is in the 2NF if it is in the first Normal form and if all non-key columns in
the table depend on the entire primary key.
2NF
Example
3NF (Third Normal Form)
• A table is in 3NF if it is in the 2NF and if all non-key columns in the table depend
non-transitively on the entire primary key.

• In simple words, the 3NF requires a table to be in the second normal form.
Additionally, every non-key column in the table must be independent of all
other non-key columns.
3NF
3NF
• A table is in the 3rd NF if it is in the second NF and if all non key columns
in the table depend non-transitively on the entire primary key.
• Another kind of relationship also exist in relational Databases. This type
of relationship is called transitive dependency. It is an indirect
relationship between two columns. Formally defined as:
• There is a functional dependency between two columns B and C, such
that C functionally dependent on B.
• We say that C transitively depends on A.
•A B C

You might also like