开发者

how to resolve long attribute value in a table

Just a simple question, say I have a table and one of their attributes is jobs... the job options can be from 0-20 characters (varchar(20))... is this okay or should I create a mapping table so that a = job1, b = job2, ..etc..etc, so when I insert to the开发者_C百科 database, I insert it as an 'a' instead of job 1.


Yes, but I would let the Jobs lookup table use an integer as the primary key instead of a, b, c, etc.

This way you can give the users a combo box or a list box to enter this value (They see the long name and not the number/key).

Also, from an administrative perspective you can let someone just enter more Jobs in the Jobs table and they will be available without any special coding.

You will have to join these tables anytime you want to link the full job description.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜