Skip to content

Conversation

YaroslavKazeev
Copy link
Contributor

Why the composite key example violates 2NF
The composite key example in the chapter uses a table where the primary key is made up of two columns: student_number and school_id. In this structure, if there is a non-prime column (a column not part of the primary key), such as name, and it depends only on part of the composite key (for example, just student_number), this is called a partial dependency. 2NF requires that all non-prime columns depend on the whole primary key, not just a part of it.

In the example, if name depends only on student_number (and not on both student_number and school_id), then the table is not in 2NF. This is because knowing just the student_number gives you the name, regardless of the school_id. This violates the rule of 2NF, which says there should be no partial dependency of any column on a subset of a candidate key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant