Re: Relational query with path expressions

From: David BL <davidbl_at_iinet.net.au>
Date: Thu, 2 Apr 2009 22:41:39 -0700 (PDT)
Message-ID: <6266e34b-a8d5-4e2d-ae77-1948f7fb2d43_at_r31g2000prh.googlegroups.com>


On Apr 3, 12:46 pm, Tegiri Nenashi <TegiriNena..._at_gmail.com> wrote:
> Granted, if you have a choice between join and generalized projection
> you can infer the type of binary operator from the type of operand. In
> the expression
>
> x.y
>
> if both are relations, you interpret it as join, and if one is a set
> of attributes, than its a projection. That is some economy of
> notation, although union, difference, and renaming still have to be
> explicit?

Yes union, intersection and difference must be explicit. For example,

    P[WEIGHT > 16].P# union SP[S# = 'S2'].P#

to retrieve the part numbers for parts that either weigh more than 16 pounds or are supplied by supplier S2 or both.

Of course quite often these set theoretic operators can be mapped to boolean operators inside a restriction. E.g.,

    P[WEIGHT > 16 or 'S2' in SP.S.S#].P#

I think equivalence of these depends on a FK constraint from SP.P# to P.P#.

I was thinking rename could be made more convenient by embellishing the syntactic sugar that the asterisk already provides. Normally the asterisk expands into all the attribute names from the input relation.

For example,

    P( *(-COLOR, WEIGHT as W), SP.S.SNAME )

is equivalent to

    P( P#, PNAME, WEIGHT as W, CITY, SP.S.SNAME ) Received on Fri Apr 03 2009 - 07:41:39 CEST

Original text of this message