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: a sort-of key question

Re: a sort-of key question

From: Jan Hidders <jan.hidders_at_REMOVETHIS.pandora.be>
Date: Sun, 20 Mar 2005 00:28:42 GMT
Message-ID: <_s3%d.41531$UB2.3691629@phobos.telenet-ops.be>


paul c wrote:
> Looking at Darwen and Date's Third Manifesto, chapter four and
> re-examining the fundamental operations that seem possible within the
> relational model (to the extent that there is any common agreement about
> what that is) I wonder how to answer the following question:
>
> What are the last names of the people who share a last name with
> somebody else?
>
> Suppose the relation R is this:
>
> LAST FIRST
> _____ _____
> Smith Billy
> Smith Bobby
> Jones Nathan
>
> I'd expect the answer to be {Smith}.

Let the relation be R(Last,First)

S := RENAME[First->First2](R)
T := R JOIN S                          // JOIN = the natural join
U := SELECT[First<>First2](T)
V := PROJECT[Last](U)

Received on Sat Mar 19 2005 - 18:28:42 CST

Original text of this message

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