Page 471 - Computer_Science_F5
P. 471
Computer Science Full name Address Movie_industry Sports
Rehema Kiongwe Mnazi Moja
Nollywood
Netball
Cricket
Mbagala
Mohamed Muki
Riverwood
Nollywood
Mbagala
Mohamed Muki
Cricket
FOR ONLINE READING ONLY
Second Normal Form (2NF) now comply with Second Normal Form
A table is in 2NF, if the relation or table (2NF). Resulting tables conforming to
is in 1NF (First Normal Form) and all Second Norm Form (2NF).
non-key attributes are fully functional
dependent on the primary key (non- Table 8.12: Teacher details
prime attribute). For example, suppose a Teacher_id Teacher_age
school wants to store the data of teachers 25 40
and the subjects they teach and, in a 47 35
school, a teacher can teach more than 83 36
one subject. Since a teacher can teach
more than one subject, the table can Table 8.13: Teacher_subject table
have multiple rows for the same teacher,
as indicated in Table 8.11. Teacher_id Subject
25 Computer
Table 8.11: An example of a table not 25 Biology
conforming to 2NF 47 English
Teacher_id Subject Teacher_age 83 Math
25 Computer 40 83 Chemistry
25 Biology 40
47 English 35 The characteristics of 2NF
83 Math 36 (a) In the 2NF, relational must be in
83 Chemistry 36 1NF.
Based on Table 8.11, we have; candidate (b) In the second normal form, all non-
keys which are {Teacher_id, Subject} key attributes are fully functional
and the Non-prime attribute is: and dependent on the primary key.
teacher_ age. Therefore, the non-prime (c) A single column Primary Key that
attribute Teacher_age is dependent on is not functionally dependent on any
Teacher_id, which is a proper subset subset of candidate key relation.
of a candidate key; thus, violating the
rule for 2NF. To convert the given table Third Normal Form (3NF)
into 2NF, we decompose it into two A table design is said to be in 3NF if
tables: Teacher details in Table 8.12 and it is in 2NF and transitive functional
Teacher- subject in Table 8.13, which dependency of the non-prime attribute
462
for Advanced Secondary Schools
Computer Science Form 5.indd 462 23/07/2024 12:34

