Re: Curious SQL question

From: Walt <wamitty_at_verizon.net>
Date: Sat, 06 Jan 2007 15:45:39 GMT
Message-ID: <DuPnh.309$Br.275_at_trndny08>


"Bob Badour" <bbadour_at_pei.sympatico.ca> wrote in message news:G8Pnh.41302$cz.607601_at_ursa-nb00s0.nbnet.nb.ca...
> Walt wrote:
>
> > "Bob Badour" <bbadour_at_pei.sympatico.ca> wrote in message
> > news:3INnh.41260$cz.607000_at_ursa-nb00s0.nbnet.nb.ca...
> >
> >>J M Davitt wrote:
> >>
> >>>Neo wrote:
> >>>
> >>>
> >>>>>select distinct orders.customer_id, products.product_id
> >>>>> from orders, products
> >>>>>minus
> >>>>>select distinct customer_id, product_id
> >>>>> from products;
> >>>>>
> >>>>>The first select esablishes a "universe of discourse" for the query
> >
> > by
> >
> >>>>>joining every customer with every product. The second select
excludes
> >>>>>products that a customer did buy.
> >>>>
> >>>>The above SQL makes the solution easy to understand (should the last
> >>>>line of the SQL be orders instead of products). Assuming the
following:
> >>>>
> >>>>set A = {shampoo, soap, bread, wine}
> >>>>set B = {shampoo, soap, bread}
> >>>>set C = {wine}
> >>>>
> >>>>What is the most appropriate name of the function that does the
> >>>>following:
> >>>>
> >>>>C = f (A, B);
> >>>>
> >>>>Is it NAND, NOT INTERSECTION, NOT IN? And should the order of the
> >>>>inputs (A, B) matter?
> >>>
> >>>Uh, isn't that 'A MINUS B' or, if you prefer, MINUS (A, B).
> >>
> >>What about XOR(A,B) ?
> >
> > Read Marshall's response, concerning "symmetric difference".
> >
> > XOR is commutative. MINUS is not. Unless I'm misreading something.
>
> Indeed. I apologize for playing with the cranks.

No problem. Even if you got rid of all the cranks, they'd just come back with electric starters.

Here's the way I see it:

XOR (A,B) = MINUS ( UNION (A,B), INTERSECTION (A,B)) Is this true? Is it a working definition? Can it be transformed so that MINUS is defined in terms of XOR, UNION, and INTERSECTION?

>
> How about f(A,B) = Drinks(A) union Vehicles(B) ?

MADD will get mad at you. Received on Sat Jan 06 2007 - 16:45:39 CET

Original text of this message