Can a primary key be equal to a different column?

Posted by eric on Stack Overflow See other posts from Stack Overflow or by eric
Published on 2013-11-02T21:47:28Z Indexed on 2013/11/02 21:53 UTC
Read the original article Hit count: 157

Filed under:

I know that a primary key must be unique, but is it okay for a primary key to be equal to a different column in the same table by coincidence?

For instance, I have 2 tables. One table is called person that holds information about a person (ID, email, telephone, address, name). The other table is staff (ID, pID(person ID), salary, position). In staff the ID column is the primary key and is used to uniquely identify a staff member. The number is from 1 - 100. However, the pID (person ID) may be equal to the ID. For instance the staff ID may be 1 and the pID that it references to may be equal to 1.

Is that okay?

© Stack Overflow or respective owner

Related posts about sql