Sample Header Ad - 728x90

Simple and Composite Candidate Key and Nulls

1 vote
1 answer
631 views
One of the differences between a candidate key and a primary key is that "candidate keys can contain nulls." I have been unable to find a more precise definition of what this means. One explanation I have seen is that in a CK with only one attribute, exactly one value can be NULL. Presumably this is because that NULL can uniquely identify a tuple/row. *Is this correct?* What I have had even more difficulty finding is what happens in a candidate key that contains more than one attribute: 1. I think I saw one reference state that **each attribute** can contain only **one** NULL. 2. However, by definition of CK, it seems there can be any number of NULLs as long as the set of attributes in the CK still uniquely identifies a single tuple/row. Which one is correct, or are they both wrong?
Asked by Ryan R. Rosario (119 rep)
Apr 3, 2022, 05:59 AM
Last activity: Apr 3, 2022, 11:56 AM