Normalization - InClass Demo
Normalization - InClass Demo
The process of decomposing relations with anomalies to produce smaller, well-structured relations
Well-structured Relation
A relation that contains minimal redundancy and allows users to insert, modify, and delete the rows in a table without errors
or inconsistencies.
First, we will discuss: Problems we encounter if we don’t perform Normalization. In other words, problems we encounter when
there is redundancy.
Then, functional dependency.
Later: How to do Normzalization? How Normalization solves these problems?
What is redundancy?
Having multiple copies (i.e., repetition) of the same data in the database.
https://www.geeksforgeeks.org/the-problem-of-redundancy-in-database/
1. Insertion Anomaly:
Let us try to insert a new faculty member
2. Deletion Anomaly:
Let us try to delete faculty data.
Loss of a related data when some other data is deleted is called deletion anomaly
3. Modification Anomaly
Modification should be performed for every row corresponding to that entity instance; otherwise, the data will
be inconsistent.
A technique of organizing the data into multiple related tables, to minimize DATA REDUNDANCY.
rows in a table
Examples:
1. Bnumber -> Name, Age, Gender, Major, DateEnrolled B0001 --> Jim, 23, M, MIS this entire statement is con
2. DateCompleted EmpID, MIS333 -> a students course completion date of a course
The functional dependency in this statement implies that the date when a course is completed is determined by the identity of the
employee and the title of the course.
Candidate Key
A candidate key is an attribute, or combination of attributes, that uniquely identifies a row in a relation. It satisfies the following properties.
1. Unique identification: For every row, the value of the key must uniquely identify that row. This property implies that each
nonkey attribute is functionally dependent on that key.
2. Nonredundancy: No attribute in the key can be deleted without destroying the property of unique identification.
All candidate keys are determinants. Not all determinants are candidate keys.
EMPLOYEE1
EMPLOYEE2
The two statements below represent the functional dependencies in EMPLOYEE2.
EmpID --> Name, DeptName, Salary
EmpID, CourseTItle --> Date Completed
Let us start with a bill and think about a table to store the data.
If we were to store the bill data in a table, it will result in the following table.
What is the issue here? multivalued attribute or repeating groups
What is the consequence?
Relational Model
INVOICE
OrderID OrderDate CustID CusName CustAddress ProdID ProdDesc
ORDER
OrderID OrderDate CustID CusName CustAddress
Order Line
OrderID ProdID OrderedQty
PRODUCT
ProdID ProdDesc ProdFinish ProdStdPrice
nds to a normal form.
between attributes (or functional dependencies are satisfied).
Oak 500.00
Oak 500.00
ve dependency
y attributes depend on other non-key attributes
non key attribut non key attribut non key attri non key attribute
CustID --> CUsName CustAddress
key attribute non key attri non key attribute
determinant.