Normalizationl
Normalizationl
Objectives
▪ Normalize relations into 1st, 2nd or 3rd normal forms.
▪ Use normalization to make well-structured relations without
anomalies
Normalization
▪ The process of breaking relations and removing anomalies to form well-structured relations. Normalization
is used for mainly two purpose, Eliminating reduntant(useless) data. Ensuring data dependencies make
sense i.e data is logically stored.
Advantages
- No DML anomalies
-Inserts, deletes, and modifications are easier to handle
-No unnecessary information
-Better performance
-Avoid Duplication and Conserve Storage
Problem without Normalization
▪ Without Normalization, it becomes difficult to handle and update the database, without facing
data loss.
▪ Insertion, Updating and Deletion Anomalies are very frequent if Database is not Normalized.
Problem without Normalization (cont.)
▪ Update Anomaly : To update address of a student who occurs twice or more
than twice in a table, we will have to update S_Address column in all the rows,
else data will become inconsistent.
▪ Insert Anomaly : Suppose for a new admission, we have a Student id(S_id),
name and address of a student but if student has not opted for any subjects yet
then we have to insert NULL there, leading to Insertion Anomaly.
▪ Deletion Anomaly : If (S_id) 401 has only one subject and temporarily he drops
it, when we delete that row, entire student record will be deleted along with it.
Functional Dependency
▪ A dependency between an attribute B to
attribute A in which the value of A
distinctively determines the value of B,
wherein attribute A is the determinant.
Example:
Student_ID, Course_name --> Date_completed.
Student_ID, Course_name --> Grade.
Functional dependencies:
emp_id -> emp_nationality
emp_dept -> {dept_type, dept_no_of_emp}
Merging Relations
▪ The following situations may determine if a Example:
database design need to be merged:
◦ When working on large projects
STUDENTA [Student_ID, Major]
◦ Combining existing databases with new requirements STUDENTB [Student_ID, Advisor]
◦ Existence of new data requirements during the
life-cycle of a database system It seems as if these can be merged to form:
STUDENT [Student_ID, Major, Advisor]
▪ Four Situations in which duplication may occur However, Advisor is dependent on Major if all
in merging database: majors have the same advisor. To settle this, we
1. Synonyms -- Two or more attributes have should create two entities:
different names but have the same meaning STUDENT [Student_ID, Major]
2. Homonyms -- The same attribute is used in MAJOR_ADVISOR [Major, Advisor]
defining more than one entity
3. Transitive Dependencies
4. Supertype/Subtype Relationships
Questions???