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: paul c <toledobythesea_at_oohay.moc>
Date: Sun, 20 Mar 2005 01:37:49 GMT
Message-ID: <Nt4%d.728651$Xk.338727@pd7tw3no>


Jan Hidders wrote:
> paul c wrote:
>

>> 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)
>
> -- Jan Hidders

thank you Jan, i don't know why i couldn't see that.

pc Received on Sat Mar 19 2005 - 19:37:49 CST

Original text of this message

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