1

I have often heard that numerically increasing numbers make good ids for static data tables. This has never made much sense to me - I would rather have meaningful ids.

To give you an example: say I am maintaining CurrencyInfo in a table. For USD, should the row identifier be 1 or USD? What is the preferred practice and why?

Do please let me know your thoughts.

Ash
  • 13
  • 2

2 Answers2

2

The id that you are talking about is known as surrogate key. You can read more about it here.

To know their advantages/disadvantages over business keys, take a look here.

You can also take a look at this answer.

Community
  • 1
  • 1
MD Sayem Ahmed
  • 28,628
  • 27
  • 111
  • 178
1

The unique identifier should NOT be something meaningful, it should be a unique identifier :) If your ID is meaningful NOW, it doesn't mean that it's meaningful later. Those things can always change..

So IMHO you should stick to a DBMS supported unique identifier. Those can be optimized etc..

duedl0r
  • 9,289
  • 3
  • 30
  • 45