Re: Dreaming About Redesigning SQL

From: Paul Vernon <paul.vernon_at_ukk.ibmm.comm>
Date: Mon, 20 Oct 2003 18:41:18 +0100
Message-ID: <bn16tr$g5a$1_at_gazette.almaden.ibm.com>


"Paul G. Brown" <paul_geoffrey_brown_at_yahoo.com> wrote in message news:57da7b56.0310171152.1ca2e61e_at_posting.google.com...
> "Marshall Spight" <mspight_at_dnai.com> wrote in message
news:<dGyjb.569403$Oz4.537552_at_rwcrnsc54>...
> > "Paul G. Brown" <paul_geoffrey_brown_at_yahoo.com> wrote in message
news:57da7b56.0310121418.43aeaf21_at_posting.google.com...
> > > Note that relations are disambiguated by their *entire* definition,
not
> > > just their names.
> >
> > That doesn't seem right. Can you justify that argument?
> >
> > Given that you can construct a projection onto one attribute
> > each of two tables and join them, this is hard to believe.
> > Maybe this is just a syntax issue, though.
>
> Sorry. Missed your question. Saw Paul Vernon's reply.
>
> To clarify: the statement you quote is intended as a definition.
>
> "In a relational schema, relations are disambiguated by the combination
> of their names and the set of their attributes."

I guess you mean "and the set of their <attribute:type> pairs" ?

I also guess that constraints don't make it into your disamiguation critera. E.g.

    RELATION Whatever ( X Integer, Y Integer )     CONSTRAINT (X >= 0);     RELATION Whatever ( X Integer, Y Integer )     CONSTRAINT (X >= 1); Would not, in your view, be two valid, separate relations in a database?

> Which lets us do this kind of thing in a relational schema:
>
> RELATION Contains ( Domain Document, Range Word);
> RELATION Contains ( Domain Polygon, Range Point);
> RELATION Contains ( Domain Polygon, Range Polygon);
>
> RELATION Species ( Id ScientificName KEY, What Document, Where
Polygon );
>
> Note that this leads to some interesting formulations of common
predicates.
> (I'm kind of re-inventing Prolog here, only without the types, so bear
> with me.)
>
>
> Q1: For any two documents what words are found in both?
> RELATION Intersection (D1, D2, W1) AS
> ( Contains (D1=Domain, W1=Range)
> Contains (D2=Domain, W1=Range) );

I don't know Prolog, would it be possible to rewrite the above as a SQL (or tutorial D) style statement (or is part of the point that it would not be trivial to do so)?

Regards
Paul Vernon
Business Intelligence, IBM Global Services Received on Mon Oct 20 2003 - 19:41:18 CEST

Original text of this message