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

From: Joe Thurbon <usenet_at_thurbon.com>
Date: Sun, 10 Oct 2010 13:58:03 +1000
Message-ID: <op.vkcda1mtq7k8pw_at_the-thurbonss-imac.local>


On Sun, 10 Oct 2010 13:23:50 +1000, Brian <brian_at_selzer-software.com> wrote:

> On Oct 9, 10:56 pm, "Joe Thurbon" <use..._at_thurbon.com> wrote:

>> On Sun, 10 Oct 2010 08:36:38 +1000, Erwin <e.sm..._at_myonline.be> wrote:
>> > On 10 okt, 00:14, Cimode <cim..._at_hotmail.com> wrote:
>>
>> >> Getting an unintuitive point across to somebody who
>> >> probably never read any significant RM theory material
>>
>> > Hmmmmmmmm. Now I'm just being curious.
>>
>> > How can you match this claim of yours with the fact that the OP
>> > explicitly states in his question that
>>
>> > "Since this is not a relation - because it contains duplicate rows -
>> > ".
>>
>> > Do you think there exists any source _BUT_ "significant RM theory
>> > material" where he could have acquired the knowledge to state that ?
>>
>> > I'm also curious as to why he's asking to be pointed out what I think
>> > should be obvious, but then again recent discussions on other subjects
>> > have revealed to me that there is no predicting when people will fail
>> > to see the obvious, merely because of certain kinds of mental block
>> > they happen to be suffering from. I'm granting the OP the benefit of
>> > the doubt that he might be suffering from a mental block of the kind
>> > "surely if SQL is so widespread, then everything it does must be
>> > right".
>>
>> 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- Hide quoted text -
>>
>> - Show quoted text -
>
> SELECT is not the same thing as projection, even if the columns in the
> select list are a proper subset of the columns in the table.  It
> follows that SELECT does not necessarily return a relation, even
> without an ORDER BY.  SELECT DISTINCT is analogous to taking a
> projection over the select list.

Indeed. Thanks.

Please revise my parenthetical to read:

(Apart from that SELECT has, in projection, a relational operator that is a close analogue, and ORDER BY doesn't, but ...)

Of course, my above post presupposes that Erwin's and Cimode's 'obvious answer' to the OP's question is that SELECT should behave in the same way as SELECT DISTINCT. (Is that what you'd choose, too?)

Cheers,
Joe Received on Sun Oct 10 2010 - 05:58:03 CEST

Original text of this message