title: Does a foreign key need to reference a primary key or candidate key?
body: <p>I am having two conflicting definitions of foreign key.</p>
  
  <p>From <a href="https://en.wikipedia.org/wiki/Foreign_key" rel="nofollow">Wikipedia</a></p>
  
  <p><code>the foreign key is defined in a second table, but it refers to the primary key in the first table.</code></p>
  
  <p>From my lecture notes:</p>
  
  <p><code>Foreign key does not have to match a primary key but must match a candidate key in some relation</code> </p>
  
  <p>Which is which? Does a foreign key need to reference a primary key or candidate key?</p>