| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: bags vs. sets
Vadim Tropashko wrote:
> On May 15, 3:38 pm, Bob Badour <bbad..._at_pei.sympatico.ca> wrote:
>
>>Marshall wrote: >> >>>We regularly deride SQL for using bags rather than sets. >>>Now, I get many of the reasons we point and laugh at SQL, >>>but I'm not so clear on this one. >> >>>We could have a language that covered sets, bags, and lists. >>>We could have a language that used bags as the basic >>>collection type and built lists and relations out of that. >>>It's not hard: a relation is a bag with a uniqueness constraint. >>>A list is a bag with a uniqueness constraint on a column >>>that belongs to the natural numbers. (Details glossed over.) >> >>>OTOH, I'm less clear how to model a bag with relations. >> >>A bag depends on physical location for identifying elements. Because >>elements in relations have no particular physical location, the very >>idea seems a little absurd.
Is the bag 0, 1, 1 the same as 1, 0, 1 ?
>>>Bags also show up in things like aggregation. The >>>sum of a column of a relation is the fold of + over >>>the bag-projection over that column. >> >>At the internal physical level, physical location is perfectly >>acceptable for identifying elements. It's just not such a good thing at >>the external logical level.
If one has sets of tuples, counting fits naturally. The above example would use tuples with a root and a multiplicity.
>>Internally, dbmses have to deal with streams and blocks and arrays and >>all sorts of physical structures. I don't see what the problem is. As >>long as the dbms manages the physical aspects without burdening the >>user, what's the problem?
![]() |
![]() |