Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 4
    +1 but what you are describing here is actually a surrogate key. Not every table has a surrogate key and even if it does the surrogate may not be the "primary" key. Commented Nov 14, 2013 at 4:33
  • 2
    +1 I thought the account number would be the surrogate key but I read up on it and you are 100% correct :) Commented Nov 14, 2013 at 12:35
  • 2
    +1 exposing it to users adds implicit requirements (e.g. remain static) Commented Nov 18, 2013 at 18:31
  • 1
    Great answer. My shorthand way of saying this is that surrogate keys are useful because no one cares about them and no one therefore cares if you change them or don't change them. If you expose them, people will start to care about them. Commented Aug 28, 2017 at 19:26
  • tl;dr: because the future. If something external comes to rely on a key, things get messy if implementation changes later on; so keep them more or less hidden to make things easier. Commented Aug 28, 2017 at 22:16