Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [surrogate-keys]

The tag has no usage guidance.

0
votes
2answers
72 views

Is it a good idea to let database surrogate key values spill out into other aspects of code (HTML, Controllers, Model, Repository layer)?

Is it acceptable to use id in HTML forms and subsequent code processing (controller, view, model, repository layers)? For example I need to show something like this on a web page: Select Motor ...
3
votes
2answers
114 views

Is it acceptable to use a surrogate key identifier as a URL parameter?

Example: in the database I have a record such as this: { id: 53, part_number: 'MOTOR-OIL', description: 'Motor Oil' } I wish to use a link that displays this record. I could refer to ...
0
votes
1answer
72 views

CRM and external systems: How to associate data with contacts?

This question is about Dynamics CRM but is valid for every system that allows merging entities. Having data related to a contact in multiple external systems, how would you know which contact the ...
5
votes
3answers
206 views

How to avoid mixing surrogate key with the rest of the data

Suppose you have a very simple CRUD where you are just storing a simple tuple-like type of data, but its natural primary key is cumbersome for the user to remember (very long, difficult to write, etc.)...
3
votes
2answers
2k views

Is is OK to use a non-primary key as the id in a rails resource?

I am getting ready to set up a resource for some new api calls to my rails application. I am planning on calling the resource devices ie resources :devices This is going to represent android mobile ...
7
votes
2answers
538 views

Is there a canonical source supporting “all-surrogates”?

Background The "all-PK-must-be-surrogates" approach is not present in Codd's Relational Model or any SQL Standard (ANSI, ISO or other). Canonical books seems to elude this restrictions too. Oracle'...
13
votes
7answers
3k views

Should a surrogate key ever be exposed to a user?

Often in a table that has no natural key, it is still useful for users to be able to have a uniquely generated identifier. If the table has a surrogate primary key (and in such a case you would ...
13
votes
4answers
815 views

Do these specific tables need surrogate keys?

Background I have this tables +-------------------------+ +------------------------+ |Airport | |Country | |-------------------------| |------------------------| |...