Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Foreign Keys
On Sun, 05 Jan 2003 16:40:56 -0500, "Matty" <mattycruft_at_daemons.net>
wrote:
>Howdy folks,
>
>I am hoping someone can clarify something for me. If I
>create a foreign key constraint on a table:
>
>ALTER TABLE bingo ADD constraint for_key_bingo
>FOREIGN KEY (col1, col2)
>REFERENCES yikes (col1,col2);
>
>and then add a new row to bingo, the col1/col2 attribute
>values have to exist in yikes. I am curious what other
>uses folks have for foreign keys?
>
>Thanks for any insight,
>Ryan
>
>
>
>
>
This can't be a serious question.
What else did you expect? The * purpose * of the foreign key is to
avoid orphaned records and to enforce relational integrity.
You need a foreign key if you have a *relationship* between 2
entities. If you don't define foreign keys and don't enforce
relational integrity, you will end up in a mess. Obviously, given your
question, you don't care about that.
Sybrand Bakker, Senior Oracle DBA
To reply remove -verwijderdit from my e-mail address Received on Sun Jan 05 2003 - 17:01:04 CST
![]() |
![]() |