I have a problem with second normal form (2NF) and I have been unable to solve it by using Google. It is making me crazy because I am a teacher and I don't want to teach wrong stuff to my students.
Let's have a table with 5 fields.
Gradings = {StudentName, SubjectCode, SubjectName, #Exam, Grade}
Dependencies are this way:
StudentName, SubjectCode, #Exam -> Grade
SubjectCode -> SubjectName
SubjectName -> SubjectCode
Therefore, candidate key 1 is {StudentName, SubjectCode, #Exam} and candidate key 2 is {StudentName, SubjectName, #Exam}.
Prime attributes are {StudentName, SubjectCode, SubjectName, #Exam} and non-prime attributes is Grade
According to the definition of second normal form, a non-prime attribute cannot depend on a part of a candidate key. The only non-prime attribute (Grade) does not depend on a part of a candidate key so this table seems in 2NF .
The problem is that I think something is amiss (and I could be wrong). I think subjects should have their own table.
Gradings = {StudentName, Subject Code, #Exam, Grade}
Subjects = {Subject Code, SubjectName}
But 2NF does not produce this. 3NF is about dependencies between non-prime attributes so it does not produce this either. But it seems to me that this is the right outcome, because it has no redundancy.
I guess if non-prime attribute was defined as "attribute that is not a candidate key", 2NF would produce the desired result. But I have checked this again and again and non-prime attribute is defined as "attribute that does not BELONG to a candidate key".
What am I doing wrong?