CAPE Information Technology: This Is in 1NF Because Each Cell Has Only 1 Value
CAPE Information Technology: This Is in 1NF Because Each Cell Has Only 1 Value
Normalisation
Database normalisation is the process of removing redundant data from your tables in to
improve storage efficiency, data integrity, and scalability.
Normalisation generally involves splitting existing tables into multiple ones, which must be re-
joined or linked each time a query is issued.
Normal Forms
A table is in first normal form if all the data values are atomic values. In other words,
there can only be one value per attribute.
There must be no duplicate groups, i.e. no attributes which occur a different number of
times on different records. For example, suppose that an employee can have multiple
skills: a possible representation of employees' skills is {Employee ID, Skill1, Skill2,
Skill3 ...}, where {Employee ID} is the unique identifier for a record. This representation
would not be in 1NF.
1
CAPE Information Technology
In order for a table to be in second normal form (2NF) it must be in first normal form
(1NF).
Have all non-key fields fully functionally dependant on the primary key. It means that
you need to use the primary key to determine the value of the other fields in the table
The table above is not in 2NF, as the quantity is functionally dependent on the primary key.
The diagram below shows how the original table has been decomposed into smaller parts. It is
now in its’ second normal form (2NF).
Ensure the original table can be rebuilt from the data contained in the new table.
2
CAPE Information Technology
In order for a table to be in Third Normal Form (3NF), it must be in second (and
therefore also first) normal form.
Have all non-key fields non-transitively dependent on the primary key. Fields which
do not form part of the primary key must always be solely dependent on the primary
key and not on anything else, such as another non key field.
In the table below, CityID is dependent on City and Salary is dependent on Type. Therefore, this
table is not in 3NF.
Below we can see that the table has be broken down into three different tables, based on the
information that was in the original table.
Advantages of Normalisation
3
CAPE Information Technology
4
CAPE Information Technology
1. Primary key: A field whose values are unique so that they can be used to access each record
2. Candidate key: A field that is considered a possibility for becoming the primary key.
However, only one field must be chosen as the primary key. Candidate keys are entirely
3. Alternate key: Any candidate field that was not used as the primary key.
4. Foreign key: a field in one table, but it is a primary key in another table. (Appears in a table