Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> db design quest
Hi, I'm looking for adivice/oppions about a db design issue. I'm using
Oracle 8.0.5.
With regard to referece type tables, is it better to store relationships based upon an integer or is it ok to use a varchar as the primary key.
My philposiphy has been to use an integer for all inter table relationships. But its a pain when it comes to refernce type tables. I've keept with the paradigm but I'm reviewing my methodology for a new project.
example:
Assume there's a reference table credit_card_type (id int , code varchar2(4) , descp varchar2(30)) with PK id and values such as:
1, AMEX, AMERICAN EXPRESS 2,VISA, VISA 3,MC, MASTER CARD
And a refrenceing table foo(....credit_card_type_id int...) with a constraint that credit_card_type_id refrences credit_card_type(id).
Is this better than this using the code as the foreing key:
credit_card_type (code varchar2(4) , descp varchar2(30)) with PK code and
AMEX, AMERICAN EXPRESS
VISA, VISA
MC, MASTER CARD
foo(....credit_card_type int...) with a constraint that credit_card_type
refrences credit_card_type(code).
...Ed Received on Tue Jun 01 1999 - 06:44:44 CDT