database - Converting a schema to a second normal form -
consider basic table schema:
studentid, student name, department, coursecode, course name, year-semester, grade
how can convert the second normal form identifying functional dependencies?
i use mnemonic device first 3 normal form. use word repeat ignoring vowels. first no repeating groups or multivalued fields, second no partial dependence on primary key , no transitory dependence.
in case looks 1nf problem rather 2nf. 2nf means partial dependence , looking @ table there no composite primary key i.e primary keys having more 1 field therefore there no possibility of partial dependence. 1nf there 2 possibilities 1 has repeated groups other 1 multi- valued fields. so, example of 1nf repeating groups here
and multi-valued example here
it better if have actual records/rows of table , ask question: there repeating groups or there multivalued fields? there can begin answering problem using examples provided above.
by way here in (stackoverflow) no-no come question without doing effort in part. have beeen if come answer first before you. understand 1st time posting here , forgivable @ least here.
based on new information:
you have:
table : student fields : studentid, student name, department table : course fields : coursecode, course name, year, semester table: tablegrade fields : studentid, courseid, grade
and if follow want tablegrade no course taken (or course offered see later on)then need either add 1 more field in course table match tablegrade table or change 1 field of tablegrade:
if want change course table this:
table: course fields: courseid, coursecode, course name, year, semester
if want change tablegrade this:
table: tablegrade fields: studentid, coursecode, grade
however, if @ course table there problem. let's have original one:
coursecode, course name, year, semester
if @ course name come on repeating unnecessarily violation 1nf, is, no repeating groups. in case coursecode , course name repeats unnecessarily.
and if use observe proposed changes mentioned still have problem:
courseid, coursecode, course name, year, semester
in case violates 3nf says no transient dependence. in case course name dependent on coursecode , not on courseid primary key.
another thing know courses has sections, have @ least
coursecode, course name, section, year, semester
so, that's why make more sense have courses taken or more appropriately course offered , add table name courses reference table.
so, new schema like:
table : student fields : studentid, student name, department table : coursesoffered fields : courseid, coursecode, section, year, semester table: courses fields : coursecode, course name table: tablegrade fields : studentid, courseid, grade
do 1 makes sense you?