sql - What is it called when there are two columns in a table that are individually unique? -
as question asks i'm wondering call when row uniquely identified 2 separate columns.
i apologize lack of formatting, here goes:
columna: 1,2,3,4,5
columnb: a,b,c,d,e
columnc: 1,2,1,2,1
columnd: a,a,b,b,a
so both column , column b each individually primary keys? don't think correct, call in terms of "keys"?
if mean every row has unique value , every row has unique b value each of them "superkey". (actually, sets {a} , {b}.)
so answer is, table has 2 one-column superkeys.
but according data no smaller set of columns of either superkey superkey, each "candidate key". (the smaller set {}, it's not superkey given data.)
so here equivalent answer is, table has 2 one-column candidate keys.
a base table , can hold example data in 5nf. there no benefit in decomposing other tables.
there tradition pick candidate key "primary key". each other 1 "alternate key". not particularly helpful tradition.
in sql primary key
or unique not null
declares superkey. can have 1 primary key
declared per table. sql not allow declaring {} superkey.
Comments
Post a Comment