Task 4 โ€” Database Normalization 22 marks

Start from one flat, unnormalized HR report table and take it to 3NF step by step: completeness 6, correctness 6, viva 10.

The unnormalized table (UNF)

A typical HR spreadsheet: one row per employee, with the whole salary history crammed into a single cell and the department stored as โ€œcode, nameโ€ together. It is unnormalized because cells are not atomic and a repeating group (the salary history) lives inside a row.

Emp_IDEmp_NameDepartmentDesignationBasic_ScaleSalary_History (Effective_Date : Net_Salary)
E01Mohd. RahmanD1, CSEProfessor850002019-01-01 : 84000 2023-01-01 : 95000
E03Rahim UddinD2, EEEAsso. Professor700002023-01-01 : 78000
E07Kamrul HasanD4, Registrar OfficeRegistrar720002021-01-01 : 74000 2023-01-01 : 80000
Anomalies in this table
AnomalyProblem
InsertionA new department with no employee yet cannot be recorded โ€” there is no row to put it in.
UpdateRenaming โ€œCSEโ€ means editing every salary row of every CSE employee; miss one and the data is inconsistent.
DeletionDeleting the last salary row of the only Registrar loses the fact that the Registrar grade exists at all.
RedundancyEmp_Name, Dept_Name and Basic_Scale are repeated once per salary revision.

A โ€” First Normal Form (1NF)

Rule: every attribute value is atomic โ€” no repeating groups, no multi-valued or composite cells, and each row is unique.

Split Department into Dept_ID + Dept_Name, and flatten the salary history so each (employee, effective date) pair becomes its own row. The primary key must now be the composite {Emp_ID, Effective_Date}, because Emp_ID alone repeats.

Emp_ID PKEffective_Date PKNet_SalaryEmp_NameDept_IDDept_NameDesignationBasic_Scale
E012019-01-0184000Mohd. RahmanD1CSEProfessor85000
E012023-01-0195000Mohd. RahmanD1CSEProfessor85000
E032023-01-0178000Rahim UddinD2EEEAsso. Professor70000
E072021-01-0174000Kamrul HasanD4Registrar OfficeRegistrar72000
E072023-01-0180000Kamrul HasanD4Registrar OfficeRegistrar72000

Functional dependencies

FD1 ย {Emp_ID, Effective_Date} โ†’ Net_Salary ย (full dependency on the whole key)
FD2 ย Emp_ID โ†’ Emp_Name, Dept_ID, Designation ย (partial โ€” only half the key)
FD3 ย Dept_ID โ†’ Dept_Name ย (transitive through a non-key attribute)
FD4 ย Designation โ†’ Basic_Scale ย (transitive through a non-key attribute)

The table is in 1NF but not 2NF: FD2 is a partial dependency on part of the composite key.

B โ€” Second Normal Form (2NF)

Rule: in 1NF and every non-key attribute is fully functionally dependent on the whole primary key โ€” no partial dependencies. (Only a composite key can violate 2NF.)

Emp_Name, Dept_ID, Dept_Name, Designation and Basic_Scale depend on Emp_ID alone, not on Effective_Date. Move them out into their own relation.

EMP_SALARY โ€” PK {Emp_ID, Effective_Date}

Emp_ID PKEffective_Date PKNet_Salary
E012019-01-0184000
E012023-01-0195000
E032023-01-0178000
E072021-01-0174000
E072023-01-0180000

EMPLOYEE_2NF โ€” PK Emp_ID

Emp_ID PKEmp_NameDept_IDDept_NameDesignationBasic_Scale
E01Mohd. RahmanD1CSEProfessor85000
E03Rahim UddinD2EEEAsso. Professor70000
E07Kamrul HasanD4Registrar OfficeRegistrar72000

Both tables are in 2NF, but EMPLOYEE_2NF still has FD3 and FD4 โ€” transitive dependencies.

C โ€” Third Normal Form (3NF)

Rule: in 2NF and no non-key attribute depends on another non-key attribute โ€” no transitive dependencies. Every non-key attribute depends on the key, the whole key, and nothing but the key.

Emp_ID โ†’ Dept_ID โ†’ Dept_Name and Emp_ID โ†’ Designation โ†’ Basic_Scale are both transitive. Extract DEPARTMENT and DESIGNATION, leaving foreign keys behind.

EMPLOYEE_3NF โ€” PK Emp_ID

Emp_ID PKEmp_NameDept_ID FKDesignation_ID FK
E01Mohd. RahmanD1G1
E03Rahim UddinD2G2
E07Kamrul HasanD4G5

DEPARTMENT โ€” PK Dept_ID

Dept_ID PKDept_Name
D1CSE
D2EEE
D4Registrar Office

DESIGNATION โ€” PK Designation_ID

Designation_ID PKDesignation_TitleBasic_Scale
G1Professor85000
G2Asso. Professor70000
G5Registrar72000

EMP_SALARY โ€” PK {Emp_ID, Effective_Date}

Carried over unchanged from 2NF; it already satisfies 3NF.

Result: 4 relations, all in 3NF. Every non-key attribute now depends on the whole key and nothing but the key โ€” no partial, no transitive dependencies. Each determinant (Emp_ID, Dept_ID, Designation_ID, {Emp_ID, Effective_Date}) is a candidate key of its relation, so these tables are in BCNF as well. This is exactly the structure implemented by the MySQL schema in Task 2.

What normalization bought us

Before (UNF)After (3NF)
Department name repeated in every salary rowStored once in DEPARTMENT; rename is a one-row UPDATE
A new department needs an employee to existInsert into DEPARTMENT independently
Deleting a salary row can erase a designationDESIGNATION survives on its own
Salary history hidden inside a cell โ€” unqueryableOne row per revision โ€” ORDER BY effective_date works

Trade-off to state in the viva: more tables โ‡’ more joins at query time. Normalize for OLTP integrity (this HR system); denormalize deliberately only for read-heavy reporting/warehouse workloads.