FK Question | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

FK Question

Can you put a foreign key constraint on a column that is not a primary key
Yes, of course. As long as there is a candidate key in the table that it is referring to. You may want to read up on foreign keys or google it to get a better understanding. Also look up identifying and non-identifying relationships to gain more depth.

A candidate key such as creating a UNIQUE constraint on the col it’s referencing?
quote:Originally posted by Tahsin Yes, of course. As long as there is a candidate key in the table that it is referring to. You may want to read up on foreign keys or google it to get a better understanding. Also look up identifying and non-identifying relationships to gain more depth.

Foreign keys can only REFERENCE Unique columns (Columns with Primary Key or Unique constraints). A foreign key CONSTRAINT can be placed on a column that has the same data type and size as the referenced key. It does not have to be unique. Nathan H. Omukwenyi
MVP [SQL Server]

]]>