UNIHIVE

Study Hub UNIPORT CSC 480

CSC 480 · Database Management

Functional dependencies and normalisation

Update, insertion and deletion anomalies, functional dependencies and their rules, closure and keys, first to third normal form, Boyce-Codd normal form, higher normal forms, decomposition properties and denormalisation.

Our notes

3 min read

Why normalise

A badly designed table repeats facts and causes anomalies. Example: one table Results(MatNo, StudentName, CourseCode, CourseTitle, Units, Score).

  • Update anomaly: changing CSC 480's title must be done in hundreds of rows; miss one and data disagree.
  • Insertion anomaly: a new course cannot be stored until a student registers it.
  • Deletion anomaly: deleting the last registration for a course loses the course's title and units.

Functional dependencies (FDs)

X → Y: each value of X determines exactly one value of Y. In Results: MatNo → StudentName; CourseCode → CourseTitle, Units; {MatNo, CourseCode} → Score.
Armstrong's axioms: reflexivity (if Y ⊆ X then X → Y), augmentation (X → Y gives XZ → YZ), transitivity (X → Y and Y → Z give X → Z). Derived: union, decomposition, pseudo-transitivity.
Closure X⁺: all attributes determined by X. If X⁺ contains every attribute, X is a superkey.
Worked example. R(A, B, C, D) with A → B, B → C, C → D. A⁺ = {A, B, C, D}: A is a key. B⁺ = {B, C, D}: not a key.

The normal forms

  • 1NF: every attribute atomic, no repeating groups (no "courses" column holding a list).
  • 2NF: 1NF and no partial dependency: no non-key attribute depends on only part of a composite key.
  • 3NF: 2NF and no transitive dependency: no non-key attribute depends on another non-key attribute.
  • BCNF: for every non-trivial FD X → Y, X is a superkey. (Stronger than 3NF; differs only when there are overlapping candidate keys.)

Worked decomposition

Results(MatNo, CourseCode, StudentName, DeptCode, DeptName, CourseTitle, Units, Score), with MatNo → StudentName, DeptCode; DeptCode → DeptName; CourseCode → CourseTitle, Units.

  • Partial dependencies (on MatNo alone and CourseCode alone) → 2NF: Student(MatNo, StudentName, DeptCode, DeptName); Course(CourseCode, CourseTitle, Units); Registration(MatNo, CourseCode, Score).
  • Transitive dependency MatNo → DeptCode → DeptName → 3NF: Student(MatNo, StudentName, DeptCode); Department(DeptCode, DeptName).

Final: Student, Department, Course, Registration: exactly the running example's tables.

BCNF example

Teaching(Student, Course, Lecturer) where each lecturer teaches one course (Lecturer → Course) and each student has one lecturer per course ({Student, Course} → Lecturer). It is in 3NF (Course is part of a key) but not BCNF (Lecturer is not a superkey). Decompose into (Lecturer, Course) and (Student, Lecturer); note this loses the dependency {Student, Course} → Lecturer, the classic BCNF trade-off.

Good decompositions

  • Lossless join: joining the parts gives back exactly the original (guaranteed if the common attributes form a key of one part).
  • Dependency preservation: every FD can be checked within a single table.

3NF can always achieve both; BCNF always lossless but not always dependency-preserving.

Higher forms

4NF removes multi-valued dependencies (a lecturer's courses and hobbies stored in one table multiply rows); 5NF deals with join dependencies.

Denormalisation

Deliberately adding redundancy (a stored CGPA, a course count) for read speed in reporting systems. Done knowingly, with rules (triggers or batch jobs) to keep copies consistent.

Exams usually ask: identify anomalies; find FDs and keys using closure; normalise a given table step by step to 3NF/BCNF; define each normal form; lossless join and dependency preservation; when to denormalise.

Common mistake: jumping straight to final tables without showing the steps. State the FDs, name each violation (partial or transitive), then decompose: the marks are in the reasoning.

Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.

Read

Watch

We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.

All CSC 480 topics

Report

Sign in to report this. It is free.

Is this your work (a lecturer, author or publisher)? Ask us to take it down.