Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: O'Reilly interview with Date

Re: O'Reilly interview with Date

From: Kenneth Downs <knode.wants.this_at_see.sigblock>
Date: Thu, 11 Aug 2005 15:24:21 -0400
Message-Id: <s5lss2-lk1.ln1@pluto.downsfam.net>


Paul wrote:

> Kenneth Downs wrote:
>>>>In my own system I never manually code a join, I just specify the two
>>>>tables and it builds it out of the foreign key definitions.
>>>
>>>What if there is more than one foreign key constraint involving the two
>>>tables?

>>
>> personally i distinguish them with a prefix code, which is put onto the
>> end of the column(s) names.
> 
> <snip>
> 

>> which is equivalent to the following DDL:
>>
>> create table examples (
>> SOMECOLUMN int PRIMARY KEY
>> )
>>
>> create table examples_xref (
>> SOMECOLUMN int REFERENCES examples(SOMECOLUMN),
>> SOMECOLUMN_TO int REFERENCES examples(SOMECOLUMN)
>> )
> 
> OK maybe I'm being dense here, but when you now specify your two tables,
> "examples" and "examples_xref", how does the system know which of the
> foreign key constraints to use to generate the join?
> 

Foreign keys are distiguished by suffix and prefix, in the example above on of them has the suffix "_TO", so when I specify a query I specify that suffix and now it can identify the fk definition and from there the columns.

-- 
Kenneth Downs
Secure Data Software, Inc.
(Ken)nneth@(Sec)ure(Dat)a(.com)
Received on Thu Aug 11 2005 - 14:24:21 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US