sql - Can a superkey include things that aren't part of the primary key? -
Can things that are not part of the primary key?
logically speaking, if the column X
in column < Code> {A, B, C} and A
are the primary keys, then {A}
, {A, B}
{A, C}
and {A, B, C}
are all superkeys because in those sets you have all Know the value in the line (if it exists.)
However, for some purposes it is not considered as a key in SQL, e.g. If the table is y
in A
and b
, then you no usually enter a foreign key Y A, B) References X (A, B)
, because {A, B}
is not the primary key if you want to be able to declare that foreign key, then you UNIQUE
constraint has to be added to X (A, B)
which is disabled as it duplicates the part of the primary key
In my opinion, this SQL In many flaws A.
Comments
Post a Comment