The normalisation process aims to minimise data duplications, avoid errors during data modifications, and simplify data queries from the database. The three fundamental normalisation forms are known as:

  • First Normal Form (1NF)Ā Ā Ā 
  • Second Normal Form (2NF)Ā Ā Ā 
  • Third Normal Form (3NF)
Doctor IDDoctor nameRegionPatient IDPatient nameSurgery NumberSurgery councilPostcodeSlot IDTotal Cost
D1KarlWest LondonP1Ā Ā Ā 

P2Ā Ā Ā 

P3
RamiĀ Ā Ā 

KimĀ Ā Ā 

Nora
3HarrowHA9SDEA1Ā Ā 

A2Ā Ā 

A3
1500 1200 1600
D1KarlEast LondonP4Ā Ā 

P5
KamelĀ Ā 

Sami
4HackneyE1 6AWA1Ā Ā 

A2
2500 1000
D2MarkEast LondonP5Ā Ā 

P6
SamiĀ Ā 

Norma
4HackneyE1 6AWA3Ā Ā 

A4
1500 2000
D2MarkWest LondonP7Ā 

P1
RoseĀ Ā 

Rami
5HarrowHA9SDEA4Ā Ā 

A5
1000Ā Ā 

1500

Following data table is in an unnormalised form:

CREATE TABLE SurgeryĀ 
	(DoctorID VARCHAR(10),
	DoctorName VARCHAR(50),
	Region VARCHAR(20),
	PatientID VARCHAR(10),
	PatientName VARCHAR(50),
	SurgeryNumber INT, Council VARCHAR(20),
	Postcode VARCHAR(10),
	SlotID VARCHAR(5),
	TotalCost Decimal
);

First normal form (atomicity)Ā Ā 

The data atomicity rule means you can only have one single instance value of the column attribute in any table cell.

CREATE TABLE Patient (
	PatientID VARCHAR(10) NOT NULL,
	PatientName VARCHAR(50),
	SlotID VARCHAR(10) NOT NULL,
	TotalCost Decimal,Ā 
	CONSTRAINT PK_Patient
	PRIMARY KEY (PatientID, SlotID));
 
CREATE TABLE Doctor (
DoctorID VARCHAR(10),
DoctorName VARCHAR(50), PRIMARY KEY (DoctorID));
 
CREATE TABLE Surgery (
SurgeryNumber INT NOT NULL,
Region VARCHAR(20), CouncilĀ VARCHAR(20),
Postcode VARCHAR(10), PRIMARY KEY (SurgeryNumber));

|Patient Table|

Patient IDPatient nameSlot IDTotal Cost
P1RamiA11500
P2KimA21200
P3NoraA31600
P4KamelA12500
P5SamiA21000
P6NormaA52000
P7RoseA61000

Doctor table:Ā Ā Ā 

Doctor IDDoctor name
D1Karl
D2Mark

Surgery table:

Surgery NumberRegionSurgery councilPostcode
3West LondonHarrowHA9SDE
4East LondonHackneyE1 6AW
5West LondonHarrowHA9SDE

By applying the atomicity rule and removing the repeating data groups, the database now meets the first normal form.

Second normal from (partial dependency)

Partial dependency refers to tables with a composite primary key. Namely, a key that consists of a combination of two or more columns, where a non-key attribute value depends only on one part of the composite key.

Patient IDPatient nameSlot IDTotal Cost
P1RamiA11500
P2KimA21200
P3NoraA31600
P4KamelA12500
P5SamiA21000
P5SamiA31000
P6SamiA41500
P7NormaA52000
P8RoseA61000
P1RamiA71500

Here, Patient name can be found from the Patient ID and the Slot ID can indicate the Total Cost. So we should redesign the Patient Table:

Patient table
Patient IDPatient name
P1Rami
P2Kim
P3Nora
P4Kamel
P5Sami
P7Norma
P8Rose

CREATE TABLE Patient (
PatientID VARCHAR(10) NOT NULL,
PatientName, VARCHAR(50), PRIMARY KEY (PatientID));
 
CREATE TABLE Appointments (AppointmentID INT NOT NULL,
SlotID, VARCHAR(10),Ā 
TotalCost Decimal, PRIMARY KEY (AppointmentID));

Third normal form (transitive dependency)

In the surgery table, the postcode and the council are non-key attributes, and the postcode depends on the council. Therefore, if you change the council value, you must also change the postcode. This is called transitive dependency, which is not allowed in the third normal form.

Surgery numberRegionSurgery councilPostcode
3West LondonHarrowHA9SDE
4East LondonHackneyE1 6AW
5West LondonHarrowHA9SDE
In other words, changing the value of the council value in the above table has a direct impact on the postcode value, because each postcode in this example belongs to a specific council. This transitive dependency is not allowed in the third normal form. To fix it we can split this table into two tables: one for the region with the city and one for the surgery:
Location Table:
Surgery numberPostcode
3HA9SDE
4E1 6AW
5HA862E
Council Table:
Surgery councilRegion
HarrowWest London
HackneyEast London
CREATE TABLE LocationĀ (
SurgeryNumber INT NOT NULL,
Postcode VARCHAR(10), PRIMARY KEY (SurgeryNumber));	
 
CREATE TABLE CouncilĀ (Council VARCHAR(20) NOT NULL,
Region VARCHAR(20), PRIMARY KEY (Council));

This ensures the database conforms to first, second, and third normal forms. The following diagram illustrates the stages through which the data moves from the unnormalized form to the first normal form, the second normal form, and finally to the third normal form.

Functional Dependency: The relationship between two attributes in a table.

Partial Dependency: A table with a composite primary key.