Re: Bags versus sets; are they needed?

From: Mikito Harakiri <mikharakiri_at_yahoo.com>
Date: 2 Apr 2002 18:28:14 -0800
Message-ID: <bdf69bdf.0204021828.89945a6_at_posting.google.com>


pkl_at_mailme.dk (Peter Koch Larsen) wrote in message news:<61c84197.0204020335.5aa9c00f_at_posting.google.com>...
> Hi all
>
> It is a wellknown fact that SQL returns duplicate values unless you
> use the SELECT DISTINCT option. What is almost as wellknown (i hope!)
> is that relational theory is based on sets.
> I believe that the original motivation for returning bags ("sets" with
> duplicate values retained) was one of performance: to eliminate the
> extra step, that would be required if duplicates were to be removed.
> My question is simple: Do you personally have code, where the
> retaining of duplicate tuples is essential/convenient/whatever? If so
> - could you provide me with an insight in to what problem is solved.

Aggregation and projection commute on bags, but don't on sets. Given that aggregation has been added to relational theory as an afterthought, purists don't think that aggregation is significant enough to cast a doubt on sets.

Here is another issue that makes me uncomfortable with sets. Consider the following example:

First Name Last Name Weight
---------- --------- ------

       Sam       Jones   135.88
      Kara       Jones   135.88

What is projection to <Last Name, Weight> is? Would it contain two records or one? Does the answer depend upon precision? Received on Wed Apr 03 2002 - 04:28:14 CEST

Original text of this message