Search code examples
databasedependencieskeynormalizationcandidate

Normalization, Primary Key Dependency Candidate Key


In the process of decomposition to normalize a relation. If I reach the point where all attributes in a relation depend on the primary key, can I assume that they will all depend entirely on the different candidate keys? If that is not a case can you please give me an example of a case where all attributes depend on the primary key, but some of them depend on the part of other candidate keys.

I'm starting learning databases


Solution

  • Surrogate primary IDs make an example really easy:

    (row_id PK, student_id, course_id, student_name)
    

    where row_id and (student_id, course_id) are candidate keys and student_id -> student_name. Of course the row_id trivially determines any other attributes if it's an auto-incremented number.