patternMinor
If a table with a surrogate key has a column known to have unique non null values (eg SSN), does it violate 3NF?
Viewed 0 times
uniquessncolumnwithhavenonnullviolate3nfhas
Problem
As I understand it, third normal form (3NF) basically means there should be exactly one key.
If a table with say an auto-increment
Ignoring practical/business issues (eg ecurity/privacy risk when passing around SSN as a key/FK), from a strictly schema design aspect, would such a table not be in 3NF because there are effectively 2 keys?
Would the answer vary on whether there was a unique key on the other column? If so, why?
If a table with say an auto-increment
id column also has a column known to be unique and not null, eg social security number, this other column could be used as the key.Ignoring practical/business issues (eg ecurity/privacy risk when passing around SSN as a key/FK), from a strictly schema design aspect, would such a table not be in 3NF because there are effectively 2 keys?
Would the answer vary on whether there was a unique key on the other column? If so, why?
Solution
A relation R is in third normal form if every non-prime attribute of R
is non-transitively dependent on each candidate key of R
E.F.Codd, 1971, Further Normalization of the Data Base Relational Model
It is implicit in the definition of a relation that a relation must have at least one key. Nothing about 3NF or any other Normal Form requires that a relation should have only one key.
Unfortunately books on database design and normalization have plentiful examples of relations with only a single key and rather fewer examples with more than one key. This strikes me as odd given that multiple keys appear to be very common practice these days. The dearth of practical examples in non-academic literature seems to be one cause of confusion about the role of keys in database design. Another cause of confusion is the popular mnemonic "nothing but the key". That phrase is usually attributed to Bill Kent but it isn't an accurate definition of 3NF.
is non-transitively dependent on each candidate key of R
E.F.Codd, 1971, Further Normalization of the Data Base Relational Model
It is implicit in the definition of a relation that a relation must have at least one key. Nothing about 3NF or any other Normal Form requires that a relation should have only one key.
Unfortunately books on database design and normalization have plentiful examples of relations with only a single key and rather fewer examples with more than one key. This strikes me as odd given that multiple keys appear to be very common practice these days. The dearth of practical examples in non-academic literature seems to be one cause of confusion about the role of keys in database design. Another cause of confusion is the popular mnemonic "nothing but the key". That phrase is usually attributed to Bill Kent but it isn't an accurate definition of 3NF.
Context
StackExchange Database Administrators Q#117679, answer score: 8
Revisions (0)
No revisions yet.