Ch6 Slides - Normalisation of Database Tables Pt. 1 (2019)
Ch6 Slides - Normalisation of Database Tables Pt. 1 (2019)
Ch6 Slides - Normalisation of Database Tables Pt. 1 (2019)
Normalisation of Database
Tables (Part 1)
CMT221/CMM222
Database Organisation and Design
Stages
First normal form (1NF)
Second normal form (2NF)
Third normal form (3NF)
Performance Redundancy
No repetition!
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
Update anomaly
Teh Je Sen (2019) 24
Example – Need for Normalisation
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
(STUD_NUM, COURSE_NUM)
(STUD_NAME ,COURSE_NAME, GPA)
(STUD_NUM, COURSE_NUM)
(STUD_NAME ,COURSE_NAME, GPA)
(STUD_NUM, COURSE_NUM)
(STUD_NAME, COURSE_NAME, HOSTEL_NUM,
HOSTEL_NAME)
STUD_IDSTU_NAME
PROJ_IDPROJ_NAME
POSTCODECITY
Steps:
Eliminate repeating groups
Identify primary key
Identify all dependencies
Step 1:
Eliminate repeating groups by ensuring that each
record is complete
Step 2:
Identify a primary key that can uniquely identify
each record
What would be a suitable primary key for the table?
Step 3:
Identify all dependencies
Depict all dependencies using a dependency
diagram
Steps:
List out all attribute names in a row
Draw arrows to indicate all functional dependencies
A B C D
Functional Dependency
Partial dependency
Functional Dependency
Steps:
Create a new table for each partial dependency
Remove dependent attributes from the main table
and put them into the new tables
Draw the normalised versions of the following tables!
STU_ID PROJ_ID STU_NAME PROJ_NAME HOURS
1001 9221 Bob Plane 2
1002 9222 Eve Boat 3
1001 9223 Bob Car 5
A B C D E F G H
A B C F
C D E
B G H
A table is in 2NF if it is
1NF
Has no partial dependencies
Transitive
dependency
A table is in 3NF if it is
2NF
Has no transitive dependencies
A B C D E F G
A B F
A E F G
B C E D
APPOINTMENT
PK App_Num
DOCTOR
FK1 Doc_EmpID
PK Doc_EmpID
App_Date
Doc_Fname
App_PatientID
Doc_Lname
App_P_Name
Doc_CellPhone
App_Postcode
App_City
App_
App_Num Doc_EmpID App_Date App_PatientID App_P_Name App_Postcode
City
2NF
3NF
App_
App_Num Doc_EmpID App_Date App_PatientID App_P_Name App_Postcode
City
2NF
App_
App_Num Doc_EmpID App_Date App_PatientID App_P_Name App_Postcode
City
2NF
3NF
PatientID P_Name Postcode City
2NF
3NF
PatientID P_Name Postcode
3NF
Postcode City
3NF
Teh Je Sen (2019) 82
Higher Normal Forms