Relational Keys and Minimal Uniqueness
Distinguish a superkey from a candidate key and check uniqueness against schema assumptions rather than accidental sample data.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
A key identifies a tuple across every legal instance
In an enrollment relation, student and course identifiers together can identify one enrollment if the policy permits at most one enrollment per pair. Adding a grade to that pair still yields uniqueness, but the resulting set is no longer minimal. A candidate key is minimal among sets that determine all attributes, and a superkey may contain extra ones. A small current table can appear unique by grade alone without that ever being a valid key.
Use constraints that reflect the operation’s identity
If the same student can enroll in the same course in several semesters, include the relevant term or another enrollment identity. A chosen primary key and other unique constraints can represent different valid ways to identify a row. SQL handling of missing values needs the actual constraint semantics. Functional dependencies express the determining relation. Lossless decomposition uses keys and determinants to show when joins recover the original data.[1][2]