Can two tables have the same primary keys?

For instance:

two tables with the same primary keys


1 Answer 1


Yes. This is a common scenario when implementing 0..1 relationships.

  • 1
    I guess you mean 1-1 relationships Commented May 5, 2016 at 8:40
  • @ypercubeᵀᴹ 1..1 relationships are impossible in practice, at least on a current RDBMS. In a 0..1 relationships, those that have the same PK, the one that gets the 0 is the one that implements the foreign key. Commented May 5, 2016 at 8:47
  • 3
    OK, we mean the same thing. I just have seen (what you note as 0..1) to be noted as 0..1 - 1 and the strict 1-1 to be noted as 1-1 (and in general, all of them to be called one-on-one). I know that strict 1-1 is difficult - but not impossible, even with DRI only. You only need deferrable constraints, which are available in Postgres (and Oracle if I am not wrong). Commented May 5, 2016 at 8:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.