Re: The Relational Model & Queries That Naturally Return Duplicate Rows

From: paul c <tuledobythesea_at_gmail.com>
Date: Thu, 14 Oct 2010 15:50:49 -0700 (PDT)
Message-ID: <17807fef-8004-4186-a06a-4b0fabbd47c6_at_g28g2000pra.googlegroups.com>


On Oct 12, 4:23 pm, "Joe Thurbon" <use..._at_thurbon.com> wrote:
> On Sun, 10 Oct 2010 19:35:44 +1000, Erwin <e.sm..._at_myonline.be> wrote:
> > On 10 okt, 04:56, "Joe Thurbon" <use..._at_thurbon.com> wrote:
>
> >> In the context of recent discussion on the ttm mailing list regarding  
> >> ORDER BY, it's not clear to me that correct answer is indeed obvious.  
> >> (In fact, given my track record on cdt, I'm not sure that I am thinking  
> >> of the correct answer).
>
> >> With that caveat in mind, given that, with the OP's database, the query
>
> >> SELECT FIRST_NAME from USERS order by FIRST_NAME
>
> >> presents the user with something that is not a relation, it seems  
> >> strange to require that
>
> >> SELECT LAST_NAME from USERS
>
> >> should. (Apart from that projection is a relational operator, and order  
> >> by isn't, but that seems to me at least to be slightly subtle).
>
> >> Cheers,
> >> Joe-
>
> >> - Tekst uit oorspronkelijk bericht weergeven -
>
> > "slightly subtle" ??????
>
> > You mean as in "that difference could equally well not exist at
> > all" ?????
>
> No I don't mean that at all. I mean that the distinction requires some  
> thought and/or experience to arrive at, rather than being obvious. The  
> 'slightly' was meant to modify the 'subtle'.
>
> [...]
>
> > If one wants SELECT to mean something different than relational
> > projection, then I refer to "Logic and Databases", chapter 12.  There,
> > "bag algebra" is investigated (and its inferiority to relational
> > algebra exposed).
>
> In the context of this thread, I don't want SELECT to do any particular  
> thing. I merely make the point that
>
> - given that ORDER BY is seen as useful, and
> - ORDER BY is not a relational operator (*), that
> - the argument that SELECT should be the same as relational projection is  
> not a foregone conclusion.
>
> I was not attempting to address the correctness of any answer, just the  
> obviousness.
>
> As to Logic and Databases, I've had the book for a while, but I'm not up  
> to chapter 12 yet. I'm not sure if I'll ever get there. Chapter 2 worries  
> me a little - for example the exposition of |- and |= is completely  
> different from every logic textbook I've ever read.
>
> Cheers,
> Joe
>
> (*) by which I mean it doesn't 'return a relation', I'm not sure if I've  
> used the terminology correctly.

Regarding the TTM thread and without criticizing type theory (I'm probably not competent to, anyway) it does mystify me why an implementation that support relational theory (the original post seemed to be about SQL db's, not the same thing) can't manage to produce, in effect, two results, one that is a relation. I don't see why implementations of relational operators can't 'ignore' facets or aspects of inputs that are immaterial to the operators. Received on Fri Oct 15 2010 - 00:50:49 CEST

Original text of this message