Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
And I add the foreign key with the alter table command.ID NUMBER PRIMARY KEY DEPT_CODE VARCHAR2(5) ...
The DEPARTMENT_CODES table has values like this:ALTER TABLE DEPARTMENT ADD CONSTRAINT DEPT_NUM_CK_FK FOREIGN KEY ( DEPT_CODE ) REFERENCES DEPARTMENT_CODES.CODE;
This way when someone try's and enters a code that is not in DEPARTMENT_CODES table they will get a integrity constraint violate.SEQ CODE NAME --- ----- ----------------------------- 1 H23R Human Resources 2 1126 R & D ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (OT) database design question
by dragonchild (Archbishop) on Oct 20, 2003 at 17:07 UTC | |
|
Re: (OT) database design question
by Plankton (Vicar) on Oct 20, 2003 at 18:58 UTC | |
by waswas-fng (Curate) on Oct 20, 2003 at 19:16 UTC | |
by Anonymous Monk on Oct 20, 2003 at 19:51 UTC | |
by dragonchild (Archbishop) on Oct 20, 2003 at 20:00 UTC | |
by graff (Chancellor) on Oct 21, 2003 at 05:25 UTC |