Ash
Ash

Reputation: 13

Database design + Table ids

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.

Upvotes: 1

Views: 150

Answers (2)

MD Sayem Ahmed
MD Sayem Ahmed

Reputation: 29166

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.

Upvotes: 2

duedl0r
duedl0r

Reputation: 9424

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..

Upvotes: 1

Related Questions