Normalisation Chapter Flashcards
(333 cards)
What does normalisation ensure?
No data redundancy
Thus removing the possibility of update anomalies
Normalisation helps to identify a suitable set of relations to represent data in the database
Stronger definition of 3NF was subsequently defined
Boyce-Codd Normal Form
Database schema
Consists of a group of relations
Relation
Consist of a set of attributes
When the Data requirements of an organisation are identified, how are these attributes grouped into suitable relations?
The common sense of the database designer.
By mapping ER diagrams onto relations.
Functional dependencies
a functional dependency is a constraint between two sets of attributes in a relation from a database
Let R be
NewStudent(stuId, lastName, major, credits, status, socSecNo)
FDs in R include
{stuId}→{lastName}, but not the reverse
{stuId} →{lastName, major, credits, status, socSecNo, stuId}
{socSecNo} →{stuId, lastName, major, credits, status, socSecNo}
{credits}→{status}, but not {status}→{credits}
Normalisation
Is the process of testing the correctness of a logical data model
What attributes are classed
Key attributes
Non-key attributes
Normalisation is a formal method
It identifies relations based on:
Primary key and the functional dependencies between their attributes
Update anomalies
To minimise data redundancy thus reducing file storage space
What are the three categories of update anomalies
Insertion anomalies
Delete anomalies
Modification anomalies
Insert a branch that currently has no members of staff into the staffBranch relation
To do this you must enter NULL in the attributes of staff but Staff_No is a primary key, primary key may not be NULL
If we remove a staff member from the StaffBranch relation we also remove information about the branch at which they work.
If the staff member happened to be the last member at this branch
What will happen?
We lose all details of that branch from the database
Change the telephone number for branch B3 in the StaffBranch relation
We must update the rows of all staff located at branch B3
If some of the rows are not updated, this results in inconsistent data
A -> B
What does this tells us?
A is said to be the determinant
B is said to be the dependent
Un-normalisation form
Contains one or more repeating groups
Attributes values are non-atomic
A relation is in 1NF if
It contains no repeating groups
All non key attributes are functionally dependent on the primary key
A relation is in 2NF if
It is in 1NF
All non key attributes are fully functionally dependent on the primary key
B is fully functionally dependent on A if
B is functionally dependent on A and not any subset of A
B is partially dependent on A if
some attribute can be removed from A and the dependency still holds
A relation is in 3NF if
It is in 2NF
Non Key attributes are not transitively dependent on the primary key
If A,B and C are attributes of a relation and
A->B and B->C
Then C is transitively dependent on A via B
Key attributes/non-key attributes example
Key attributes: A key attribute is the unique characteristic of the entity. For ex. Name and hire date are attributes of the entity Employee
Non-Key Attributes: Non-key attributes are attributes that are not part of a key. Consider attributes for first name, last name, birth date;
Full functional dependency example
Definition: A full functional dependency occurs when you already meet the requirements for a functional dependency and the set of attributes on the left side of the functional dependency statement cannot be reduced any farther
Examples: For example, “{SSN, age} -> name” is a functional dependency, but it is not a full functional dependency because you can remove age from the left side of the statement without impacting the dependency relationship.