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

From: Joe Thurbon <usenet_at_thurbon.com>
Date: Wed, 13 Oct 2010 09:23:38 +1000
Message-ID: <op.vkhkloynq7k8pw_at_the-thurbonss-imac.local>


On Sun, 10 Oct 2010 19:35:44 +1000, Erwin <e.smout_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. Received on Wed Oct 13 2010 - 01:23:38 CEST

Original text of this message