How to define a natural id in database?
Posted
by
gcc
on Programmers
See other posts from Programmers
or by gcc
Published on 2012-06-22T08:07:16Z
Indexed on
2012/06/23
9:25 UTC
Read the original article
Hit count: 242
There are a lot of manuals. I am trying to create an database to hold information of these documents. But, there is a small problem. How can I give meaningful id to the manuals? Are there any standard or logic behind the giving meaningful id to the documents? If there is no standard, can you tell me how I should do that?
example:
table :
manual id | manual name
EDIT:
Not Meaningful ID
1 or M1 or foo
2 C2 bar
3 P123 name
... ... ...
(i) (ii) (iii)
(i) Not meaningful for me because if some item deleted, there can be gap. ex 1 33 100.
(ii) random character can be confusing when one try to give a name to new manual
(iii) Why giving name is not preferred is because finding a name to the manual as ID is hard after 500 manuals.
Meaningful :
New ID
* Can be easily produced even if after 1000 manuals
* Should not be so complicated
© Programmers or respective owner