CS FundamentalsHardProduct company interview · GATE level

A relation Enrollment(student_id, course_id, semester, grade) has candidate key (student_id, course_id, semester). A functional dependency student_id, course_id → grade also holds (i.e. a student's grade in a course doesn't depend on which semester is recorded, perhaps because retakes always show the latest grade under the same key). Is this FD a violation of 2NF?

  1. A. No, because grade is only ever accessed together with semester
  2. B. No, because this FD does not involve semester at all, so it cannot affect normalization
  3. C. Yes, but only because of BCNF, not 2NF
  4. D. Yes, because (student_id, course_id) is a proper subset of the key (student_id, course_id, semester), and grade is non-prime — this is a textbook partial dependency

Correct answer: D. Yes, because (student_id, course_id) is a proper subset of the key (student_id, course_id, semester), and grade is non-prime — this is a textbook partial dependency

The declared candidate key is the full triple (student_id, course_id, semester). Since (student_id, course_id) is a proper, non-empty subset of that key, and grade is a non-prime attribute depending on just that subset, this is exactly a partial dependency — a direct 2NF violation, regardless of what the FD 'means' conceptually.

More DBMS and SQL questions

Exams that ask this topic