Re: Curious SQL question

From: Walt <wamitty_at_verizon.net>
Date: Fri, 05 Jan 2007 19:52:41 GMT
Message-ID: <d0ynh.9$3L1.0_at_trndny03>


"Neo" <neo55592_at_hotmail.com> wrote in message news:1168021174.237093.190700_at_i15g2000cwa.googlegroups.com...
> > 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?
>

Can't there be more than one function f that meets the criteria?

If the function is what I imagine it to be, the best name is "set difference", IMO. And yes, the order does matter, just as is does in f(x,y) = x - y Received on Fri Jan 05 2007 - 20:52:41 CET

Original text of this message